⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sc_fdma.m

📁 应用MATLAB编程
💻 M
字号:

function time_sig = SC_FDMA(fre_sym)
%clc
%fre_sym:预编码后的数据
% Convert frequency symbols into time signals by IFFT
% The IFFT points is 64, oversampling is adopted, and 4 pilot symbols are inserted

% Ralted paramters are as following:
% Number of data subcarriers: Nsd = 48
% Subcarrier frequency spacing: fs = 0.3125MHz ( = 20MHz/64)
% Total bandwidth: ft = fs * Nst = 52 * 0.3125MHz = 16.25MHz
% IFFT/FFT period: T_FFT = 1/fs =1/0.3125M = 3.2us
% Guard interval: T_GI = T_FFT/4 = 3.2us/4 = 0.8us
% OFDM symbol period: T_sym = T_FFT + T_GI = 3.2+0.8 = 4us
% IFFT/FFT sampling point: 64, over sampling
% Sampling rate: T_FFT/64 = 0.05us

N=512;
N_SPF=7;%一个时隙包含7个SC-FDMA符号
Nsd =48;                                     % Number of data subcarriers
%fre_sym=ones(1,672);

%%%%%%%%%%%%%%%%%%%%%资源映射%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OFDM_sym_slot1_1 = reshape(fre_sym(1:length(fre_sym)/8), Nsd/4, N_SPF)          % Reshape the modulated symbols into OFDM symbols
OFDM_sym_slot1_2 = reshape(fre_sym(length(fre_sym)/8+1:length(fre_sym)/4), Nsd/4, N_SPF) 
OFDM_sym_slot1_3 = reshape(fre_sym(length(fre_sym)/4+1:3/8*length(fre_sym)), Nsd/4, N_SPF) 
OFDM_sym_slot1_4 = reshape(fre_sym(3/8*length(fre_sym)+1:1/2*length(fre_sym)), Nsd/4, N_SPF) 
OFDM_sym_slot2_1 = reshape(fre_sym(1/2*length(fre_sym)+1:5/8*length(fre_sym)), Nsd/4, N_SPF)          % Reshape the modulated symbols into OFDM symbols
OFDM_sym_slot2_2 = reshape(fre_sym(5/8*length(fre_sym)+1:6/8*length(fre_sym)), Nsd/4, N_SPF) 
OFDM_sym_slot2_3 = reshape(fre_sym(6/8*length(fre_sym)+1:7/8*length(fre_sym)), Nsd/4, N_SPF) 
OFDM_sym_slot2_4 = reshape(fre_sym(7/8*length(fre_sym)+1:length(fre_sym)), Nsd/4, N_SPF)
OFDM_sym_slot1=[OFDM_sym_slot1_1;OFDM_sym_slot1_2;OFDM_sym_slot1_3;OFDM_sym_slot1_4]
OFDM_sym_slot2=[OFDM_sym_slot2_1;OFDM_sym_slot2_2;OFDM_sym_slot2_3;OFDM_sym_slot2_4];
OFDM_sym=[OFDM_sym_slot1,OFDM_sym_slot2];%一个子帧数据 48行×14列
OFDM_sym = OFDM_sym.';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%SC-FDMA信号生成(做512点的ifft,加上CP,就上信道)%%%%%%%%%%%%%
time_sig = zeros(N, N_SPF*2);
cyc_sig=zeros(160,14);
cyc_sig_pie=zeros(144,14);
for m = 1: N_SPF*2 
    temp_sym = OFDM_sym(m,:);% Modulate symbols to be allocated to the mth OFDM symbol of current frame  
                     
    sym_IFFT =temp_sym;
    temp = ifft(sym_IFFT,N)*sqrt(N);%这一块儿为什么要乘以sqrt(N)(杨睛的疑惑,5.12)?
    temp = temp.';
    time_sig(:,m) = temp;  % IFFT, convert frequency symbols to time signals
   % pilot_num = mod(pilot_num,128)+1;                % Pilot symbol index + 1 
   if m==1|m==8
   cyc_sig(:,m)=[time_sig(N-159:N,m)];
   else
   cyc_sig_pie(:,m)=[time_sig(N-143:N,m)];
   cyc_sig(:,m)=[zeros(16,1);cyc_sig_pie(:,m)];  %CP长度为144的,在其前面补16个0
   end
end
signal_total = [cyc_sig;time_sig];            % Add cyclic prefix to the time signal
time_sig=signal_total(:).'                 % Parallel to Serial
    
    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -