LP_filter.m
上传用户:shencti
上传日期:2016-08-16
资源大小:16k
文件大小:2k
源码类别:

邮电通讯系统

开发平台:

Matlab

  1. %%低通滤波器
  2. function [signal_I,signal_Q,signal_I_noise,signal_Q_noise]=LP_filter(N,M,code_cycle,fs,Rece_Signal_Quan_down_I,Rece_Signal_Quan_down_Q,Rece_Signal_Quan_down_I_noise,Rece_Signal_Quan_down_Q_noise,EmulateIndex)      %进过低通滤波器
  3. global filter_previous_I;
  4. global filter_previous_Q;
  5. global filter_previous_I_noise;
  6. global filter_previous_Q_noise;
  7. %%下变频后通过低通滤波器
  8.   
  9.     freq_replace=58.08e6;
  10.     wp = code_cycle*2/fs;                  % 归一化数字截止频率
  11.     b = fir1(10,wp);                  % 11个系数,即10阶海明窗FIR通滤波 
  12.     b=round(b*2^8);
  13. %       滤波器系数量化
  14. %       b_bit=8;
  15. %       b_step=1/(2^7);
  16. %       b=round(b/b_step);
  17. if 1==mod(EmulateIndex,M)
  18.     Rece_Signal_Quan_down_I=[0 0 0 0 0 0 0 0 0 0 Rece_Signal_Quan_down_I];
  19.     Rece_Signal_Quan_down_Q=[0 0 0 0 0 0 0 0 0 0 Rece_Signal_Quan_down_Q];
  20.     Rece_Signal_Quan_down_I_noise=[0 0 0 0 0 0 0 0 0 0 Rece_Signal_Quan_down_I_noise];
  21.     Rece_Signal_Quan_down_Q_noise=[0 0 0 0 0 0 0 0 0 0 Rece_Signal_Quan_down_Q_noise];
  22. else
  23.     Rece_Signal_Quan_down_I=[filter_previous_I Rece_Signal_Quan_down_I];
  24.     Rece_Signal_Quan_down_Q=[filter_previous_Q Rece_Signal_Quan_down_Q];
  25.     Rece_Signal_Quan_down_I_noise=[filter_previous_I_noise Rece_Signal_Quan_down_I_noise];
  26.     Rece_Signal_Quan_down_Q_noise=[filter_previous_I_noise Rece_Signal_Quan_down_Q_noise];
  27. end
  28.     signal_I_filter = filter(b,1,Rece_Signal_Quan_down_I);
  29.     signal_Q_filter= filter(b,1,Rece_Signal_Quan_down_Q);
  30.     signal_I_nosie_filter = filter(b,1,Rece_Signal_Quan_down_I_noise);
  31.     signal_Q_nosie_filter = filter(b,1,Rece_Signal_Quan_down_Q_noise);
  32.   
  33.     signal_I_filter=round(signal_I_filter/2^9);
  34.     signal_Q_filter=round(signal_Q_filter/2^9);  
  35.     signal_I_nosie_filter=round(signal_I_nosie_filter/2^9);
  36.     signal_Q_nosie_filter=round(signal_Q_nosie_filter/2^9);
  37.     signal_I=signal_I_filter(11:(N+10));
  38.     signal_Q=signal_Q_filter(11:(N+10));
  39.     signal_I_noise=signal_I_nosie_filter(11:(N+10));
  40.     signal_Q_noise=signal_Q_nosie_filter(11:(N+10));
  41.     filter_previous_I=Rece_Signal_Quan_down_I((N+1):(N+10));
  42.     filter_previous_Q=Rece_Signal_Quan_down_Q((N+1):(N+10));
  43.     filter_previous_I_noise=Rece_Signal_Quan_down_I_noise((N+1):(N+10));
  44.     filter_previous_Q_noise=Rece_Signal_Quan_down_Q_noise((N+1):(N+10));