ofdm_demod.m
上传用户:look542
上传日期:2009-06-04
资源大小:784k
文件大小:1k
源码类别:

传真(Fax)编程

开发平台:

Matlab

  1. function ofdm_sym = ofdm_demod( fine_freq_out, PrefixRatio, N_subc, N_sym_ts, N_ts ,N_Rx_ant ,AddChFreq)
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. % 实现OFDM的基本解调
  4. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5. if ~AddChFreq
  6.     
  7.     ofdm_sym = zeros(N_subc,N_sym_ts*N_ts,N_Rx_ant);
  8.     cp_len = round(PrefixRatio*N_subc);
  9.     
  10.     for ant = 1:N_Rx_ant
  11.         ofdm_tmp = reshape( fine_freq_out(1,:,ant), N_subc*(1+PrefixRatio) , N_sym_ts*N_ts );
  12.         cp_cut = ofdm_tmp( cp_len + 1:end,: );
  13.         % fft乘1/sqrt(N_subc)以保证变换前后能量不变
  14.         % 我们假设频域的样点是在[-fs/2  fs/2]中的, fs是采样频率
  15.         % fftshift目的是使得变换后的频域样点在[-fs/2  fs/2]中,而不是[0 fs]中
  16.         ofdm_sym(:,:,ant) = fftshift(1/sqrt(N_subc) * fft( cp_cut ), 1);
  17.     end
  18.     
  19. else
  20.     ofdm_sym = NaN;
  21. end