Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views5 pages

Exp 9

The document outlines the design of various FIR filters including low pass, high pass, band pass, and band reject filters using rectangular and Hamming windows. Each filter design is accompanied by MATLAB code that computes and plots the magnitude response of the filters. The code utilizes frequency response functions and visualizes the results for different filter types with specified parameters.

Uploaded by

pskiran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

Exp 9

The document outlines the design of various FIR filters including low pass, high pass, band pass, and band reject filters using rectangular and Hamming windows. Each filter design is accompanied by MATLAB code that computes and plots the magnitude response of the filters. The code utilizes frequency response functions and visualizes the results for different filter types with specified parameters.

Uploaded by

pskiran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

DESIGNING OF LOW PASS FILTER USING RECTANGULAR AND

HAMMING WINDOWS :-

PROGRAM:-

clear all;

wc=0.5*pi;

N=25;

alpha=(N-1)/2;eps=0.001;

n=0:1:N-1;

hd=sin(wc*(n-alpha+eps))./(pi*(n-alpha+eps));

wr=boxcar(N);

hn=hd.*wr';

w=0:0.001:pi;

h=freqz(hn,1,w);

plot(w/pi,abs(h));

hold on

wh=hamming(N);

hn=hd.*wh';

w=0:0.01:pi;

h=freqz(hn,1,w);

plot(w/pi,abs(h),'-.');grid

xlabel('Normalised frequency \omega/\pi');

ylabel('Magnitude');

title('Magnitude Response of FIR Low Pass Filter using Rectangular and


Hamming windows');

hold off
DESIGNING OF HIGH PASS FILTER USING HAMMING AND
RECTANGULAR WINDOWS :-

PROGRAM:-

clear all;

wc=.5*pi;

N=25;

alpha=(N-1)/2;eps=0.001;

n=0:1:N-1;

hd=(sin(pi*(n-alpha+eps))-sin(wc*(n-alpha+eps)))./(pi*(n-alpha+eps));

wr=boxcar(N);

hn=hd.*wr';

w=0:0.01:pi;

h=freqz(hn,1,w);

plot(w/pi,abs(h));

hold on

wh=hamming(N);

hn=hd.*wh';

w=0:0.01:pi;

h=freqz(hn,1,w);

plot(w/pi,abs(h),'-.');grid

xlabel('Normalised frequency \omega/\pi');

ylabel('Magnitude');

title('Magnitude Response of FIR High Pass Filter using Hamming and


Rectangular windows');

hold off
DESIGNING OF BAND PASS FILTER USING RECTANGULAR AND
HAMMING WINDOWS :-

PROGRAM:-

clear all;

wc1=.25*pi;wc2=0.75*pi;

N=25;

alpha=(N-1)/2;eps=0.001;

n=0:1:N-1;

hd=(sin(wc2*(n-alpha+eps))-sin(wc1*(n-alpha+eps)))./(pi*(n-alpha+eps));

wr=boxcar(N);

hn=hd.*wr';

w=0:0.01:pi;

h=freqz(hn,1,w);

plot(w/pi,abs(h));

hold on

wh=hamming(N);

hn=hd.*wh';

w=0:0.01:pi;

h=freqz(hn,1,w);

plot(w/pi,abs(h),'-.');grid

xlabel('Normalised frequency \omega/\pi');

ylabel('Magnitude');

title('Magnitude Response of FIR Band Pass Filter using Rectangular and


Hamming windows');

hold off
DESIGNING BAND REJECT FILTER USING RECTANGULAR AND
HAMMING WINDOWS:-

PROGRAM:-

clear all;

wc1=.25*pi;wc2=0.75*pi;

N=25;

alpha=(N-1)/2;eps=0.001;

n=0:1:N-1;

hd=(sin(wc1*(n-alpha+eps))-sin(wc2*(n-alpha+eps))+sin(pi*(n-
alpha+eps)))./(pi*(n-alpha+eps));

wr=boxcar(N);

hn=hd.*wr';

w=0:0.01:pi;

h=freqz(hn,1,w);

plot(w/pi,abs(h));

hold on

wh=hamming(N);

hn=hd.*wh';

w=0:0.01:pi;

h=freqz(hn,1,w);

plot(w/pi,abs(h),'-.');grid

xlabel('Normalised frequency \omega/\pi');

ylabel('Magnitude');

title('Magnitude response of Band Reject Filter using Rectangular and


Hamming windows');
hold off

You might also like