Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
16 views

Digital Signal Processing Lab 4

This document describes a MATLAB assignment to design FIR filters using Hamming windowing techniques. The aim is to create low pass, high pass, band pass, and band stop filters. The algorithm involves getting filter parameters, calculating the order, finding window coefficients, and plotting magnitude responses. FIR filters have a finite impulse response that settles to zero within a defined time period, unlike IIR filters with unlimited responses due to feedback. Using Hamming windowing in MATLAB can successfully modify frequency responses to achieve desired filter properties for different applications.

Uploaded by

Shreemay Bhuyan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Digital Signal Processing Lab 4

This document describes a MATLAB assignment to design FIR filters using Hamming windowing techniques. The aim is to create low pass, high pass, band pass, and band stop filters. The algorithm involves getting filter parameters, calculating the order, finding window coefficients, and plotting magnitude responses. FIR filters have a finite impulse response that settles to zero within a defined time period, unlike IIR filters with unlimited responses due to feedback. Using Hamming windowing in MATLAB can successfully modify frequency responses to achieve desired filter properties for different applications.

Uploaded by

Shreemay Bhuyan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Digital Signal Processing Lab

Assignment-4
NAME: SHREEMAY KUMAR BHUYAN
Reg No: 21BEE0100

AIM: Design FIR Low pass, High pass, Band pass and Band stop filter using hamming
windowing techniques.
Apparatus Required: System with MATLAB R2022b.
Algorithm:
• Get the pass band and stop band ripples.
• Get the pass band and stop band edge frequencies.
• Get the sampling frequency.
• Calculate the order of the filter.
• Find the window coefficients.
• Plot the magnitude responses.
Theory:
Contrary to infinite impulse response (IIR) filters, which can have unlimited responses as
a result of internal feedback, a finite impulse response (FIR) filter's response settles to
zero over a defined period of time. FIR filters can react instantly.
and have an impulsive response with a limited time. An Nth-order FIR filter's impulse
response lasts for exactly N + 1 samples before settling to zero. FIR filters are available in
discrete-time and continuous-time domains in both digital and analogue formats.

MATLAB Program:
%SHREEMAY KUMAR BHUYAN 21BEE0100
%Enter the passband ripple= 0.02
%Enter the stopband ripple= 0.01
%Enter the passband frequency= 1000
%Enter the stopband frequency= 1500
%Enter the sampling frequency= 5000
rp=input('Enter the passband ripple= ');
rs=input('Enter the stopband ripple= ');
fpb=input('Enter the passband frequency= ');
fsb=input('Enter the stopband frequency= ');
fs=input('Enter the sampling frequency= ');
wp=2*fpb/fs;
ws=2*fsb/fs;
num=(-20*log10(sqrt(rp*rs)))-13;
den=14.6*(fsb-fpb)/fs;
n=ceil(num/den);
n1=n+1;
if(rem(n,2)~=0)
n1=n;
n=n-1;
end
y=hamming(n1);
%LOW PASS FILTER
b=fir1(n,wp,y);
[h, w]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(w/pi,m,'c');
ylabel('Gain(dB)');
xlabel('Normalized Frequency');
title('Magnitude Response of a low pass FIR Filter');
%HIGH PASS FILTER
b=fir1(n,wp,'high',y);
[h, w]=freqz(b,1,256);
g=20*log10(abs(h));
subplot(2,2,2);
plot(w/pi,g,'m');
ylabel('Gain(dB)');
xlabel('Normalized Frequency');
title('Magnitude Response of a high pass FIR Filter');
%Band Pass Filter
wn=[wp ws];
b=fir1(n,wn,'bandpass',y);
[h, w]=freqz(b,1,256);
L=20*log10(abs(h));
subplot(2,2,3);
plot(w/pi,L,'g');
ylabel('Gain(dB)');
xlabel('Normalized Frequency');
title('Magnitude Response of a Band pass FIR Filter');
%BAND STOP Filter
wn=[wp ws];
b=fir1(n,wn,'stop',y);
[h, w]=freqz(b,1,256);
o=20*log10(abs(h));
subplot(2,2,4);
plot(w/pi,o,'y');
ylabel('Gain(dB)');
xlabel('Normalized Frequency');
title('Magnitude Response of a Band Stop FIR Filter');
Output:
Result:
FIR Low pass, High pass, Band pass and Band stop filters were designed using Hamming
window.
INFERENCE:
In conclusion, employing Hamming windowing techniques while creating FIR (Finite
Impulse Response) filters in MATLAB can be a successful strategy for getting desired filter
properties.
A typical window function that aids in modifying the frequency response of the filter is
the hamming window. Different forms of FIR filters, such as low pass, high pass, band
pass, and band stop filters, can be developed and implemented using MATLAB's signal
processing toolbox. The particular frequency requirements of the application determine
the type of filter that should be used.

You might also like