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

传真(Fax)编程

开发平台:

Matlab

  1. function [fine_freq_out,offset] = fine_freq_syn( timed_sym,WinStart2, WinSize2, Delay3, T_sample,N_Rx_ant,delta_fc,TurnOn )
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. % 精频偏估计
  4. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  5. if TurnOn
  6.     
  7.     time_idx = [ 0 : length(timed_sym) - 1 ] ;
  8.     for ant = 1:N_Rx_ant
  9.         
  10.         % 延时相关,取角度
  11.         recv = timed_sym(1,WinStart2  : WinStart2 + WinSize2 - 1, ant);
  12.         recv_delayed = timed_sym(1,WinStart2 + Delay3 : WinStart2 + WinSize2 + Delay3 - 1, ant);
  13.         
  14.         offset_metric = sum( recv .* conj( recv_delayed ) );
  15.         offset(ant) = - angle(offset_metric)/(2*pi*Delay3*T_sample);
  16.         
  17.         % 载波频偏粗估计纠正, 方法1, 在每条接收天线上进行纠正
  18.         % fine_freq_out(1,:,ant) = recv_frame(1,:,ant).*exp(-j*2*pi*offset(ant).*time_idx*T_sample);
  19.     end
  20.     
  21.     % 载波频偏粗估计纠正, 方法2 , 合并一个频偏纠正值,在每条接收天线上进行纠正
  22.     offset = sum(offset)/N_Rx_ant;
  23.     time_idx = repmat(time_idx,[1,1,N_Rx_ant]);
  24.     fine_freq_out = timed_sym.*exp(-j*2*pi*offset.*time_idx*T_sample);
  25.     
  26.     % 计算载波频偏纠正误差
  27.     %err_freq2 = delta_fc - offset;
  28. else
  29.     fine_freq_out = timed_sym;
  30. end