You are on page 1of 8

LAB MANUAL

COURSE: DSP-3105

Information and Communication Technology


Faculty of Science & Technology
Bangladesh University of Professionals (BUP)

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.

Linear time-invariant (LTI) system


A linear system in which an input-output pair, x(n) and y(n), is invariant to a shift k in time is called
a linear time-invariant system i.e.,
y(n) = L[x(n)] ⇒ L[x(n − k)] = y(n − k) ………………. (6)
For an LTI system the L[·] and the shifting operators are reversible as shown here.
Difference Equations
An LTI discrete system can also be described by a linear constant coefficient difference equation
of the form
………….. (7)

Another form of this equation is


……… (8)

A solution to this equation can be obtained in the form


y(n) = yH(n) + yP (n) …………. (9)

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

[Hint: use the following MATLAB function

s=filter(b,a,x)

Response would be look like this:]

Useful MATLAB Commands:


h=impz(b,a,n) s=filter(b,a,x)
LAB WORK
Given the following difference equation:
y(n) -0.6y(n-1)+ 1.2y(n-2)= x(n); ∀n
Impulse Response
c. Calculate and plot the impulse response h(n) at n = −10, . . . , 50.
d. Level the X and Y coordinate and use a title of the response.

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.

Responses would be look like this:


REPORT:
1. Submit a report on your lab work along with the corresponding MATLAB script file and
figure window for each work.
2. Clearly label x-axis, y-axis, and title in each figure.
3. Answer all the questions in Lab Work.

Warning
1. Don’t copy from your mates.

Reference
1. Digital Signal Processing Using MATLAB®, Third Edition Vinay K. Ingle, John G.
Proakis.

You might also like