ofdm_demod.m
上传用户:gzcxg999
上传日期:2021-07-15
资源大小:190k
文件大小:1k
源码类别:

matlab例程

开发平台:

CHM

  1. function [training_sym ,data_sym] = ofdm_demod(fine_freq_out,PrefixRatio,N_subc,N_sym,N_tran_sym,N_Rx_ant)
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. % 实现OFDM的基本解调
  4. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5. training_sym = zeros(N_subc,1,N_Rx_ant);
  6. data_sym = zeros(N_subc,N_sym,N_Rx_ant);
  7. cp_len = round(PrefixRatio*N_subc);
  8. for ant = 1:N_Rx_ant
  9.     ofdm_tmp = reshape( fine_freq_out(1,:,ant), N_subc*(1+PrefixRatio) , N_sym + N_tran_sym - 1 );
  10.     cp_cut = ofdm_tmp( cp_len + 1:end,: );
  11.     % fft乘1/sqrt(N_subc)以保证变换前后能量不变
  12.     % 我们假设频域的样点是在[-fs/2  fs/2]中的, fs是采样频率
  13.     % fftshift目的是使得变换后的频域样点在[-fs/2  fs/2]中,而不是[0 fs]中
  14.     ofdm_sym(:,:,ant) = fftshift(1/sqrt(N_subc) * fft( cp_cut ), 1);
  15. end
  16. training_sym = ofdm_sym(:,1,:);             % 用于信道估计的训练符号
  17. data_sym = ofdm_sym(:, 2:N_sym+1 ,:);     % 数据OFDM符号, 包括导频符号