DIGITAL SIGNAL PROCESSING LAB
(EL-3031)
LABORATORY MANUAL
Frequency response of LTI systems
(LAB # 08)
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 07, 2016
Verified by: Dr. Shahzad Saleem, Dr. Farhan Khalid Updated: Spring 2023
DSP - Lab National University Roll No: __________
08
Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
Lab Title: Frequency response of LTI systems.
Lab Objective: Implementing difference equation and know how to evaluate the frequency
response of LTI system in Matlab.
The tasks given in lab include:
Compute the output ‘y[n]’ of an LTI system expressed in difference
equation form and verify the result using ‘dltidemo’.
Evaluate the impulse response and step response of causal finite-
dimensional LTI discrete time system.
Compute the output ‘y[n]’ of an LTI system expressed in difference
equation form.
Evaluate the magnitude and phase response of moving average filter.
Generate the smoothed output ‘y[n]’ from the niose corrupted ‘x[n]’using
moving average system.
Tools used:
MATLAB
Lab Description:
LTI system:
Difference Equation:
Introduction
One of the most important concepts of DSP is to be able to properly represent the
input/output relationship to a given LTI system. A linear constant-coefficient difference equation
(LCCDE) serves as a way to express just this relationship in a discrete-time system. Writing the
sequence of inputs and outputs, which represent the characteristics of the LTI system, as a
difference equation help in understanding and manipulating a system.
Definition 1: difference equation
_____________________________________________________________________________________________
Page 2 of 7
DSP - Lab National University Roll No: __________
08
Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
An equation that shows the relationship between consecutive values of a sequence
and the differences among them. They are often rearranged as a recursive formula so that a
systems output can be computed from the input signal and past outputs.
Example
y[n] +7y[n−1] +2y[n−2] =x[n] −4x[n−1] (1)
General Formulas from the Difference Equation :
As stated briefly in the definition above, a difference equation is a very useful tool in describing
and calculating the output of the system described by the formula for a given sample n. The key
property of the difference equation is its ability to help easily find the transform, H(z) , of a
system. In the following two subsections, we will look at the general form of the difference
equation and the general conversion to a z-transform directly from the difference equation.
Difference Equation:
The general form of a linear, constant-coefficient difference equation (LCCDE), is shown
below:
From this equation, note that y[n−k] represents the outputs and x[n−k] represents the inputs. The
value of N represents the order of the difference equation and corresponds to the memory of the
system being represented. Because this equation relies on past values of the output, in order to
compute a numerical solution, certain past outputs, referred to as the initial conditions, must be
known.
Impulse response of LTI system:
Output of an LTI system ("at rest") is completely determined by the input and the
response to an impulse.
_____________________________________________________________________________________________
Page 3 of 7
DSP - Lab National University Roll No: __________
08
Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
Step response of LTI systems:
Input is the unit function to LTI sytem.
Moving-average filter:
_____________________________________________________________________________________________
Page 4 of 7
DSP - Lab National University Roll No: __________
08
Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
DLTI Demo:
DLTIDemo is a program that illustrates the relationship between the input and output of
a discrete-time linear time-invariant (LTI) filter when the input is a sinusoidal signal.
The user is allowed to control the parameters of both the input sinusoid and the digital
filter.
Lab Tasks:
Task#1: Compute the output y[n] using MATLAB, of an LTI system given by the following
system equation
y[n]=0.5(x[n] – x[n-1])
The input x[n] is given by:
x[n]=2.07cos(0.2*pi*n + 0.179*pi)
where let n=0:100.
Solve it mathematically.
Plot the graph of ‘y[n]’ obtained mathematically and compare it with ‘y1[n]’ which is
obtained by convolving ‘x[n]’ and ‘h[n]’.
Evaluate the resulting phase shift using plots.
Verify the result by using demo named ’ dltidemo’ in MATLAB.
Task#2: : Evaluate the impulse response and step response of the causal finite-dimensional LTI
discrete-time system as described by the equation.
y[n] +0.7y[n-1]] – 0.45y[n-2] - 0.6y[n-3]=0.8x[n] – 0.44x[n-1] + 0.36x[n-2]+0.02x[n-3]
Task#3: Calculate the output y[n] an LTI system given by the following equation,
y[n]=-6.76195( x[n] +x[n-2]) + 13.456335x[n-1],
The x[n] is causal and is given by,
x[n]={cos(0.1n) + cos(0.4n)}u[n]
_____________________________________________________________________________________________
Page 5 of 7
DSP - Lab National University Roll No: __________
08
Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
Task#4: Evaluate the magnitude and phase response of moving-average filter of length M1=5 and
M2=14. The impulse response of moving-average filter is given by,
h[n]={ 1/M, 0<=n<=M-1 ; 0 , otherwise}
Task#5 : Write MATLAB code to generate the smoothed output y[n] from the noise corrupted
x[n] using the moving average system?
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: ______________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Student's Signature: _________________________________
_____________________________________________________________________________________________
Page 6 of 7
DSP - Lab National University Roll No: __________
08
Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
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%)
1 Analysis of Practical Skill Able to attempt Able to attempt Able to attempt Able to attempt Able to attempt
discrete-time Observation complete lab with 80% of the lab 60% of the lab 40% of the lab 20% of the lab
signals and during proper tasks tasks tasks tasks
verifying their experimentati labeling/explanatio
properties i.e. on & Lab n of results and
Discrete Fourier Reports proper commenting
Transform of the code
(DFT), Discrete
Time Fourier
Transform
(DTFT) using
MATLAB.
_____________________________________________________________________________________________
Page 7 of 7