DSPRelated.com
Code

Frequency response of window functions for FIR Filter

Senthilkumar March 21, 20112 comments Coded in Scilab

This Program is used to find and plot the Frequency response of
(1) Hanning window (2)Hamming window for M = 11

//Program to find and plot the frequency response of
//(1) Hanning window (2)Hamming window for M = 11 
clear all;
close;
clc
M = 11;
for n = 1:M
  h_hann_11(n) = 0.5-0.5*cos(2*%pi*(n-1)/(M-1));
  h_hamm_11(n) = 0.54-0.46*cos(2*%pi*(n-1)/(M-1));
end
subplot(2,1,1)
[h_hann_11_M,fr]=frmag(h_hann_11,512);
h_hann_11_M = 20*log10(h_hann_11_M./max(h_hann_11_M));
plot2d(fr,h_hann_11_M,2);
title('Frequency Response 0f Hanning window Filter length M =11')
subplot(2,1,2)
[h_hamm_11_M,fr]=frmag(h_hamm_11,512);
h_hamm_11_M = 20*log10(h_hamm_11_M./max(h_hamm_11_M));
plot2d(fr,h_hamm_11_M,2);
title('Frequency Response of Hamming window Filter length M =11')