0% found this document useful (0 votes)
2 views4 pages

DSP Lab Exp9

The document outlines an experiment for designing FIR filters (Low Pass and High Pass) using the windowing technique in MATLAB. It includes MATLAB programs for both filter types, detailing the use of Rectangular, Triangular, and Blackman windows, along with expected input/output and frequency response graphs. The result confirms the successful design of FIR filters, and an exercise is provided for further practice in filter design.

Uploaded by

me.rithvika
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)
2 views4 pages

DSP Lab Exp9

The document outlines an experiment for designing FIR filters (Low Pass and High Pass) using the windowing technique in MATLAB. It includes MATLAB programs for both filter types, detailing the use of Rectangular, Triangular, and Blackman windows, along with expected input/output and frequency response graphs. The result confirms the successful design of FIR filters, and an exercise is provided for further practice in filter design.

Uploaded by

me.rithvika
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/ 4

DSP Lab

Experiment: 09
DESIGN FIR FILTER USING WINDOWING TECHNIQUE

Aim: To Design FIR filter (Low Pass Filter /High Pass Filter) using windowing technique.

Apparatus: PC having MATLAB software.

Theory:
DSP Lab
DSP Lab

MATLAB Program:
1. Program for Low Pass FIR Filter Design Using Rectangular and Triangular Windows

% Low Pass FIR Filter Design Using Windows


clc;
clear all;
N=input('Enter order of filter: ');
Fp=input('Enter pass band edge frequency: ');
Fs=input('Enter sampling frequency ');
Wp=2*pi*Fp/Fs;
b1=fir1(N,Wp,boxcar(N+1)); %FIR Filter design using Rectangular window
b2=fir1(N,Wp,triang(N+1)); %FIR Filter design using Triangular window
[h,w]=freqz(b1,1); % obtain Frequency response for Rectangular window
plot(w/pi,20*log10(abs(h))); %Plot Frequency response for Rectangular window
hold on
[h,w]=freqz(b2,1); % obtain Frequency response for Triangular window
plot(w/pi,20*log10(abs(h)),'-g'); %Plot Frequency response for Triangular window
xlabel('normalized frequency');
ylabel('Magnitude in dB');
title('Low pass frequency response');
legend('Rectangular','Triangular');
hold off

Expected Input/Output:
Enter order of filter: 21
Enter pass band edge frequency: 500
Enter sampling frequency 5000
Expected Graphs:

Low pass frequency response


20
Rectangular
Triangular
0

-20
Magnitude in dB

-40

-60

-80

-100

-120
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
normalized frequency
DSP Lab

2. Program for High Pass FIR Filter Design Using Rectangular and Blackman Windows
% High Pass FIR Filter Design Using Windows
clc;
clear all;
N=input('Enter order of filter: ');
Fp=input('Enter pass band edge frequency: ');
Fs=input('Enter sampling frequency ');
Wp=2*pi*Fp/Fs;
b1=fir1(N,Wp,'high',boxcar(N+1)); %FIR Filter design using Rectangular window
b2=fir1(N,Wp,'high',blackman(N+1)); %FIR Filter design using Blackman window
[h,w]=freqz(b1,1); % obtain Frequency response for Rectangular window
plot(w/pi,20*log10(abs(h))); %Plot Frequency response for Rectangular window
hold on
[h,w]=freqz(b2,1); %obtain Frequency response for Blackman window
plot(w/pi,20*log10(abs(h)),'-g'); %Plot Frequency response for Blackman
window
xlabel('normalized frequency');
ylabel('Magnitude in dB');
title('High pass frequency response');
legend('Rectangular','Blackman');
hold off
Expected Input/Output:
Enter order of filter: 20
Enter pass band edge frequency: 500
Enter sampling frequency 5000
Expected Graphs:
High pass frequency response
20
Rectangular
0 Blackman

-20

-40
Magnitude in dB

-60

-80

-100

-120

-140
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
normalized frequency

Result:
Thus FIR filter for Low pass and High pass are designed using MATLAB

Exercise:
1. Write the MATLAB code for FIR filter Design for pass band and Stop band.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy