Pages

Saturday, May 7, 2011

EFFECT OF RECTANGULAR | HAMMING | HANNING | BLACK MAN WINDOWS ON FIR lowpass filter

clear all;
close all;
f=input('enter the freq');
N=input('enter the number of samples');
w=2*pi*f;
alpha=(N-1)/2;
h=zeros(1,N);
for n=0:1:N-1
    if n~=(N-1)/2
    h(n+1)=sin(w*(n-alpha))/((n-alpha)*pi);
    h(n+1)=1-h(n+1);
    end
end
h(((N-1)/2)+1)=w/pi;
rectangular_window=boxcar(N);
ham=hamming(N);
han=hanning(N);
black=blackman(N);
h1=h.*rectangular_window';
h2=h.*ham';
h3=h.*han';
h4=h.*black';
w=0:.01:pi;
H1=freqz(h1,1,w);
H2=freqz(h2,1,w);
H3=freqz(h3,1,w);
H4=freqz(h4,1,w);
plot(w/pi,abs(H1),'r',w/pi,abs(H2),'g',w/pi,abs(H3),'y',w/pi,abs(H4));


OUTPUT
enter the freq 0.3*pi
enter the samples 33

PLOT

EFFECT OF WINDOWS ON FIR lowpass filter

2 comments:

  1. Hi guys catch all the program codes that are needed for placements or during any course at
    www.ezeecodes.blogspot.com

    ReplyDelete
  2. please i need a matlab code for digital filter design using bilinear transformation.please help!

    ReplyDelete