Pages

Wednesday, April 27, 2011

DESIGN FIR LOWPASS FILTER WITH CUTOFF FREQUENCY 0.5*pi using RECTANGULAR WINDOW

clear all;
wcutoff=input('ENTER THE CUT OFF FREQUENCY in radians eg: 0.5*pi--->');
N=input('ENTER THE NUMBEROF SAMPLES eg: N=25--->');
alpha=(N-1)/2;
epso=.001;          %to prevent singularity when n=alphan=0:1:N-1;
hd=sin(wcutoff*(n-alpha+epso))./(pi*(n-alpha+epso));
                              %expression for FIR Lowpass filterwr=boxcar(N);       %expression for Rectangular window
hn=hd.*wr';            %wr'=transpose of wr
w=0:0.01:pi;
h=freqz(hn,1,w);    %MATLAB function for frequency response
xlabel('Normalised frequency \omega/\pi');
ylabel('Magnitude');
plot(w/pi,abs(h));  %to plot the graph


OUTPUT

ENTER THE CUT OFF FREQUENCY in radians eg: 0.5*pi--->0.5*pi
ENTER THE NUMBER OF SAMPLES eg: N=25--->31

PLOT


FIR LOWPASS FILTER USING RECTANGULAR WINDOW

No comments:

Post a Comment