Professional Documents
Culture Documents
COURSE: DSP-3105
Laboratory Manual
Prepared by: Supervised by:
Saiful Islam Dr. Md. Junaebur Rashid
Lecturer of ICT, BUP Associate Professor of EEE, DU
Experiment Name: Response of the LTI system by difference equation
Objectives:
1. To understand the linear time invariant (LTI)system and difference equation
2. To understand the LTI system response: impulse and step response by difference equation
3. To learn how to generate and plot LTI system response by difference equation in
MATLAB.
Pre-Lab works
1. Read carefully the experiment manual before attending the lab.
2. See the theory lecture notes (bring them with you if necessary).
3. Practice the examples given in this experiment at home for better class performance.
4. Do not bring any relevant MATLAB codes, neither in any portable device nor in written
form.
5. Familiarize yourself with the MATLAB commands that may be required for this lab (see
the list).
Discrete Systems
Mathematically, a discrete-time system (or discrete system for short) is described as an operator
T[·] that takes a sequence x(n) (called excitation) and transforms it into another sequence y(n)
(called response). That is,
𝑦(𝑛) = 𝑇[𝑥(𝑛)] … … … … … …. (1)
In DSP we will say that the system processes an input signal into an output signal. Discrete systems
are broadly classified into linear and nonlinear systems. We will deal mostly with linear systems.
Linear Systems
A discrete system T[·] is a linear operator L[·] if and only if L[·] satisfies the principle of
superposition, namely,
………………. (2)
We know,
........………… (3)
Using (2) and (3), the output y(n) of a linear system to an arbitrary input x(n) is given by
……….. (4)
The response L[δ(n − k)] can be interpreted as the response of a linear system at time n
due to a unit sample (a well-known sequence) at time k. It is called an impulse response
and is denoted by h(n, k). The output then is given by the superposition summation
……… … … … … … (5)
The computation of (5) requires the time-varying impulse response h(n, k), which in practice is not
very convenient. Therefore time-invariant systems are widely used in DSP.
EXAMPLE
Given the following difference equation:
y(n) − y(n − 1) + 0.9y(n − 2) = x(n); ∀n
Impulse Response
a. Calculate and plot the impulse response h(n) at n = −20, . . . , 100.
b. Level the X and Y coordinate and use a title of the response.
Step Response
a. Calculate and plot the unit step response s(n) at n = −20, . . . , 100.
b. Level the X and Y coordinate and use a title of the response.
MATLAB Coding (Impulse Response)
% Response of the LTI system by difference equation (Impulse Response)
clc;
clear all;
close all
% Difference Equation
% y(n)- y(n-1) + 0.9y(n-2) = x(n); ∀n
b=[1]; % co-efficient
a=[1, -1, 0.9]; % co-efficient
n=[-20:120];
h=impz(b,a,n); % to plot the impulse response
subplot(2,1,1); stem(n,h)
title('Impulse Response'); xlabel('n'); ylabel('s(n)')
MATLAB Coding (Step Response)
Do it by yourself
s=filter(b,a,x)
Step Response
Given the following difference equation:
y(n) +0.2y(n-1) +0.7y(n-2)= -x(n); ∀n
a. Calculate and plot the unit step response s(n) at n = −30, . . . , 60.
b. Level the X and Y coordinate and use a title of the response.
Warning
1. Don’t copy from your mates.
Reference
1. Digital Signal Processing Using MATLAB®, Third Edition Vinay K. Ingle, John G.
Proakis.