ip_06_04.m
上传用户:loeagle
上传日期:2013-03-02
资源大小:1236k
文件大小:1k
源码类别:

通讯编程文档

开发平台:

Matlab

  1. % MATLAB script for Illustrative Problem 6.4.
  2. echo on
  3. Length=101;
  4. Fs=10000;
  5. W=2000;
  6. Ts=1/Fs;
  7. n=-(Length-1)/2:(Length-1)/2;
  8. t=Ts*n;
  9. h=2*W*sinc(2*W*t);        
  10. % The rectangular windowed version follows.
  11. N=61;
  12. rec_windowed_h=h((Length-N)/2+1:(Length+N)/2);
  13. % Frequency response of rec_windowed_h follows.
  14. [rec_windowed_H,W1]=freqz(rec_windowed_h,1);
  15. % to normalize the magnitude
  16. rec_windowed_H_in_dB=20*log10(abs(rec_windowed_H)/abs(rec_windowed_H(1)));
  17. % The Hanning windowed version follows.
  18. hanning_window=hanning(N);
  19. hanning_windowed_h=h((Length-N)/2+1:(Length+N)/2).*hanning_window.';
  20. [hanning_windowed_H,W2]=freqz(hanning_windowed_h,1);
  21. hanning_windowed_H_in_dB=20*log10(abs(hanning_windowed_H)/abs(hanning_windowed_H(1)));
  22. % Plotting commands follow.