www.gusucode.com > OFDM_16QAM系统仿真源码程序 > OFDM_16QAM系统仿真源码程序/code/tx_fre_to_time.m
function time_sig = tx_fre_to_time(fre_sym,N_SPF,pilot_syms,pilot_num) % 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 % Number of pilot subcarriers: Nsp = 4 % Number of total subcarriers: Nst = 52 % 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 Nst = 52; % Number of total subcarriers Nsd = 48; % Number of data subcarriers OFDM_sym = reshape(fre_sym, Nsd, N_SPF); % Reshape the modulated symbols into OFDM symbols OFDM_sym = OFDM_sym.'; time_sig = zeros(64, N_SPF); pilot=[1,1,1,-1]; for m = 1: N_SPF temp_sym = OFDM_sym(m,:);% Modulate symbols to be allocated to the mth OFDM symbol of current frame temp_pilot = pilot_syms(pilot_num).*pilot(); % Pilot symbols to be allocated to the mth OFDM symbol of current frame % Allocate the subcarrier frequency according to IEEE802.11a stand. P23,subclause (17.3.5.9) sym_minus_fre = [zeros(1,6),temp_sym(1:5),temp_pilot(1),temp_sym(6:18),temp_pilot(2),temp_sym(19:24)]; % Allocate symbol to the minus frequency band sym_plus_fre = [0,temp_sym(25:30),temp_pilot(3),temp_sym(31:43),temp_pilot(4),temp_sym(44:48),zeros(1,5)]; % Allocate symbol to the plus frequency band sym_IFFT = [sym_plus_fre,sym_minus_fre]; % Total IFFT symbols temp = ifft(sym_IFFT)*sqrt(64); temp = temp.'; time_sig(:,m) = temp; % IFFT, convert frequency symbols to time signals pilot_num = mod(pilot_num,128)+1; % Pilot symbol index + 1 end cyc_sig = time_sig(49:64,:); % Cyclic prefix interval: T_GI = T_FFT/4 signal_total = [cyc_sig;time_sig]; % Add cyclic prefix to the time signal time_sig=signal_total(:).'; % Parallel to Serial