0% found this document useful (0 votes)
2 views

DSP Lab Spring 23 Exp-10-11

The document is a laboratory manual for a Digital Signal Processing (DSP) lab focused on the design of simple FIR and IIR filters. It outlines various tasks for students to implement filter transfer functions using MATLAB, including lowpass and highpass filters, and provides a feedback section for students to evaluate their lab experience. The manual also includes an assessment rubric for evaluating student performance in designing digital filters.

Uploaded by

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

DSP Lab Spring 23 Exp-10-11

The document is a laboratory manual for a Digital Signal Processing (DSP) lab focused on the design of simple FIR and IIR filters. It outlines various tasks for students to implement filter transfer functions using MATLAB, including lowpass and highpass filters, and provides a feedback section for students to evaluate their lab experience. The manual also includes an assessment rubric for evaluating student performance in designing digital filters.

Uploaded by

fakhar_fast
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

DIGITAL SIGNAL PROCESSING LAB

(EL-3031)
LABORATORY MANUAL

Design of Simple FIR and IIR Filters

(LAB # 10–11)
Student Name: ______________________________________________

Roll No: ________________ Section: ____

Date performed: _____________, 2023

____________________________________________________________________________________________________________________________________________________________

NATIONAL UNIVERSITY OF COMPUTER AND EMERGING SCIENCES, ISLAMABAD

Prepared by: Engr. Muhammad Asim


Last Edited by: Engr. Muhammad Asim, Mar 17, 2016
Verified by: Dr. Shahzad Saleem, Dr. Farhan Khalid Updated: Spring 2023
DSP - Lab National University Roll No: __________
10

Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
Lab # 09: Design of Simple FIR and IIR Filters
Learning Objectives
 FIR Lowpass Filter Design
 FIR Highpass Filter Design
 IIR Lowpass Filter Design
 IIR Highpass Filter Design
 All Pass Transfer Function cascaded with IIR Transfer Function
Equipment Required
1. PC
2. Matlab
1. Introduction:
One of the main applications of digital signal processing is in filtering discrete-time signals to
remove undesirable components. The frequency responses of the four types of ideal filters are
shown in Figure below. These filters have doubly infinite impulse responses and are not
realizable. In many applications, fairly simple realizable approximations to these filters are
quite adequate.

The impulse response h LP [n ]of the ideal low pass filter of above Figure is given by
_____________________________________________________________________________________________
Page 2 of 8
DSP - Lab National University Roll No: __________
10

Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
sin ( w c n )
h LP [ n ] =
πn
FIR Filters:
It is always possible to design an FIR transfer function with an exact linear phase response.
Such a transfer function corresponds either to a symmetric impulse response defined by
h [ n ] =h [ N −n ] 0≤ n ≤ N
Or an antisymmetric impulse response defined by
h [ n ] =−h [ N −n ] 0≤ n ≤ N
Where N is the order of the transfer function and the length of h[n] is N+1. There are four
types of such transfer functions:
Type 1: Symmetric Impulse Response with Odd Length.
Type 2: Symmetric Impulse Response with Even Length.
Type 3: Antisymmetric Impulse Response with Odd Length.
Type 4: Antisymmetric Impulse Response with Even Length.
A Type 2 FIR transfer function must have a zero at z =-1, and as a result, it cannot be used to
design a high pass filter. A Type 3 FIR transfer function must have a zero at z=1 and z =−1
and, therefore, cannot be used to design either a low pass, a high pass, or a band stop filter. A
Type 4 FIR transfer function is not appropriate for designing a low pass filter due to the
presence of a zero at z =1. The Type 1 FIR filter has no such restrictions and can be used to
design almost any type of filter.
The simplest low pass FIR filter of length 2(Moving Average Filter with M=2) has a transfer
function given by
1 −1
H 0 ( z )= (1+ z )
2
π
It can be shown that this filter has a 3-dB cutoff frequency w c = . By cascading a number of
2
these simple FIR low pass filters, a low pass filter with a sharper magnitude response can be
obtained.
A cascade of K sections of H 0 ( z )has a Transfer function

( )
K
1 −1
G 0 ( z )= (1+ z )
2
And has 3-dB cutoff frequency at
−1
−1
w c =2 cos ( 2 2 K )
A slight modification of the difference equation of Moving Average Filter yields a high pass
filter whose transfer function is given by

_____________________________________________________________________________________________
Page 3 of 8
DSP - Lab National University Roll No: __________
10

Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
M −1
1
H1 (z )=
M
∑ (−1)n z−n
n=0

Its 3-dB cutoff frequency is given by


π
w c=
2
Same as with cascaded low pass filters, we can cascade the simple high pass filters to obtain
sharper magnitude response.
IIR Filters:
A first-order low pass IIR transfer function H LP ( z ) is given by
(1−α ) ( 1+ z−1 )
H LP ( z )= . −1
0 <|α |<1
2 1−αz
Where |α| < 1 for stability. The frequency w c where the gain is 3dB below its maximum value
at dc (ω=0), called the 3-dB cutoff frequency, is related to the parameter α through
1−sin wc
α=
cos w c
A first-order high pass IIR transfer function H HP (z) is given by
( 1+α ) ( 1−z−1 )
H HP ( z )= . −1
0<|α|<1
2 1−αz
Where |α| < 1 for stability. The frequency w c where the gain is 3dB below its maximum value
at dc (ω=0), called the 3-dB cutoff frequency, is related to the parameter α through
1−sin wc
α=
cos w c
By cascading the simple digital filters described above, digital filters with sharper magnitude
responses can be implemented. For example, for a cascade of K first-order low pass sections,
the overall structure has a transfer function G LP ( z ) given by

( )
k
( 1−α ) ( 1+ z−1 )
G LP ( z )= . −1
2 1−αz
Similarly transfer function G HP ( z) for a cascade of K first-order High pass sections is given
by

( )
k
( 1+α ) ( 1−z−1)
G HP ( z)= . −1
2 1−αz

_____________________________________________________________________________________________
Page 4 of 8
DSP - Lab National University Roll No: __________
10

Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________

Task#01:
a) Implement the above given transfer function H 0 ( z )of FIR Lowpass filter using “tf”
function in matlab.
b) Find poles and zeros of above computed transfer function and plot these using “zplane”
command. Write down type of the filter.
c) Find frequency response using “freqz” function and plot its magnitude and phase
response.
d) Observe the phase response whether it is linear or not?
e) Plot the gain function of filter and find its 3dB cutoff frequency. Compare it with
mathematically computed w c.
Task#02:
a) Implement the above given transfer function G0 ( z )of cascaded FIR Lowpass filter
using “tf” function in matlab witk K=3.
b) Find poles and zeros of above computed transfer function and plot these using “zplane”
command. Write down type of the filter.
c) Find frequency response using “freqz” function and plot its magnitude and phase
response.
d) Compare this frequency response with frequency response of a single low pass FIR
filter.
e) Observe the phase response whether it is linear or not?
f) Plot the gain function of filter and find its 3dB cutoff frequency. Compare it with
mathematically computed w c.

Task#03:
a) Implement the above given transfer function H 1 ( z ) of FIR Highpass filter (with M = 2)
using “tf” function in matlab.
b) Find poles and zeros of above computed transfer function and plot these using “zplane”
command. Write down type of the filter.
c) Find frequency response using “freqz” function and plot its magnitude and phase
response.
d) Observe the phase response whether it is linear or not?
e) Plot the gain function of filter and find its 3dB cutoff frequency. Compare it with
mathematically computed w c.
Task#04:
a) Implement the transfer function G1 ( z ) of cascaded FIR Highpass filter using “tf”
function in matlab witk K=3.
b) Find poles and zeros of above computed transfer function and plot these using “zplane”
command. Write down type of the filter.
c) Find frequency response using “freqz” function and plot its magnitude and phase
response.
d) Compare this frequency response with frequency response of a single high pass FIR
filter.
_____________________________________________________________________________________________
Page 5 of 8
DSP - Lab National University Roll No: __________
10

Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
e) Observe the phase response whether it is linear or not?
f) Plot the gain function of filter and find its 3dB cutoff frequency. Compare it with
mathematically computed w c.
Task#05:
a) Implement the above given transfer function H LP ( z ) of IIR Lowpass filter using “tf”
function in matlab.
b) Find poles and zeros of above computed transfer function and plot these using “zplane”
command.
c) Find frequency response using “freqz” function and plot its magnitude and phase
response.
d) Observe the phase response whether it is linear or not?
e) Plot the gain function of filter and find its 3dB cutoff frequency. Compare it with
mathematically computed w c.
f) Change the value of α and observe how w c changes with α .
Task#06:
a) Implement the above given transfer function H HP ( z ) of IIR Highpass filter using “tf”
function in matlab.
b) Find poles and zeros of above computed transfer function and plot these using “zplane”
command.
c) Find frequency response using “freqz” function and plot its magnitude and phase
response.
d) Observe the phase response whether it is linear or not?
e) Plot the gain function of filter and find its 3dB cutoff frequency. Compare it with
mathematically computed w c.
f) Change the value of α and observe how w c changes with α .

Task#07:
a) Implement the above given transfer function G LP ( z )of cascaded Lowpass IIR filter
system using “tf” function in matlab witk K=3.
b) Find poles and zeros of above computed transfer function and plot these using “zplane”
command.
c) Find frequency response using “freqz” function and plot its magnitude and phase
response.
d) Compare this frequency response with frequency response of a single low pass IIR
filter.
e) Observe the phase response whether it is linear or not?
f) Plot the gain function of filter and find its 3dB cutoff frequency. Compare it with
mathematically computed w c.

Task#08:
a) Implement the above given transfer function G HP ( z ) of cascaded Highpass IIR filter
system using “tf” function in matlab witk K=3.
b) Find poles and zeros of above computed transfer function and plot these using “zplane”
command.

_____________________________________________________________________________________________
Page 6 of 8
DSP - Lab National University Roll No: __________
10

Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
c) Find frequency response using “freqz” function and plot its magnitude and phase
response.
d) Compare this frequency response with frequency response of a single high pass IIR
filter.
e) Observe the phase response whether it is linear or not?
f) Plot the gain function of filter and find its 3dB cutoff frequency. Compare it with
mathematically computed w c

Task#09:
a) Using MATLAB compute and plot the group delay of the causal LTI discrete-time
system with a transfer function given by
−1 −2 −3
z −1.2 z + z
H ( z )= −1 −2 −3
1−1.3 z +1.04 z −0.222 z
HINT: Use the “grpdelay” function.

b) Find allpass transfer function for above system by using “iirgrpdelay” function.
c) Cacade the H(z) with above computed allpass T.F to generate H1(z).
d) Find group delay of H1(z) and compare it with above computed group delay.

Student's feedback: Purpose of feedback is to know the strengths and weaknesses of the system
for future improvements. This feedback is for the 'current lab session'. Circle your choice:

[-3 = Extremely Poor, -2 = Very Poor, -1 = Poor, 0 = Average, 1 = Good, 2 = Very Good, 3 = Excellent]:
The following table should describe your experience with:
S# Field Rating Describe in words if required
1 Overall Session -
-2 -1 0 1 2 3
3
2 Lab Instructor -
-2 -1 0 1 2 3
3
3 Lab Staff -
-2 -1 0 1 2 3
3
4 Equipment -
-2 -1 0 1 2 3
3
5 Atmosphere -
-2 -1 0 1 2 3
3

Any other valuable feedback: ______________________________________________________


______________________________________________________________________________
_____________________________________________________________________________________________
Page 7 of 8
DSP - Lab National University Roll No: __________
10

Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

Student's Signature: _________________________________

AWARDED

Correctness

Conclusion
Originality
of results

Initiative
Neatness
MARKS

Attitude

TOTAL
TOTAL 10 10 10 20 20 30 100

EARNED

Lab Instructor's Comments:________________________________________________________


______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

Lab Instructor's Signature: _________________________________

Assessment Rubric
LLO Statement Assessment Exemplary Proficient Developing Beginning Worst
Method (20%) (20%) (20%) (20%) Performance
(20%)
2 Design of finite- Practical Skill Able to attempt Able to attempt Able to attempt Able to attempt Able to attempt
impulse response Observation complete lab with 80% of the lab 60% of the lab 40% of the lab 20% of the lab
(FIR) and during proper tasks tasks tasks tasks
infinite-impulse experimentati labeling/explanatio
response (IIR) on & Lab n of results and
digital filters in Reports proper commenting
MATLAB. of the code

_____________________________________________________________________________________________
Page 8 of 8

You might also like