0% found this document useful (0 votes)
115 views6 pages

DSP Lab#05

This document is a lab manual for studying discrete time systems in MATLAB. It contains objectives, software requirements, and introduction to linear time-invariant (LTI) systems and their properties. Exercises are provided to analyze systems for linearity/nonlinearity and time-invariance/time-variance. Students are asked to modify MATLAB code to simulate different systems, compare outputs, and determine system properties. A lab report is required analyzing the results of the exercises.

Uploaded by

Aayan Shah
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)
115 views6 pages

DSP Lab#05

This document is a lab manual for studying discrete time systems in MATLAB. It contains objectives, software requirements, and introduction to linear time-invariant (LTI) systems and their properties. Exercises are provided to analyze systems for linearity/nonlinearity and time-invariance/time-variance. Students are asked to modify MATLAB code to simulate different systems, compare outputs, and determine system properties. A lab report is required analyzing the results of the exercises.

Uploaded by

Aayan Shah
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/ 6

National University of Modern Languages, Rawalpindi

FACULTY OF ELECTRICAL ENGINEERING


ELECTRICAL ENGINEERING DEPARTMENT

Digital Signal Processing

Lab Manual No 05

DISCRETE TIME SYSTEMS

Instructor:
Engr. M. Tahir Saeed

Digital Signal Processing Session:Fall-2019


National University of Modern Languages, Rawalpindi
FACULTY OF ELECTRICAL ENGINEERING
ELECTRICAL ENGINEERING DEPARTMENT

Objectives:-
In this lab we will study the linearity and nonlinearity of the system using MATLAB. The
objectives of this lab are:

1) To study and check the linearity and non linearity of the system
2) To study the Time invariant and time varying system

Software:
 MATLAB 2013

Introduction:
Mathematically, a discrete-time system is described as an operator T[.] that takes a
sequence x(n) called excitation and transforms it into another sequence y(n) (called
response). Discrete time systems can be classified into two categories i) LTI systems
ii) NON-LTI systems. A discrete system T[.] is a linear operator L[.] if and only if L[.]
satisfies the principle of superposition, namely

L[a1x1(n) + a2x2(n)] = a1L[x1(n)] + a2Lx2(n)] and A discrete system is time-invariant if

Shifting the input only causes the same shift in the output

A system is said to be bounded-input bounded-output (BIBO) stable if everybounded


input produces a bounded output.

An LTI system is BIBO stable if and only if its impulse response is absolutelysummable.

Digital Signal Processing Session:Fall-2019


National University of Modern Languages, Rawalpindi
FACULTY OF ELECTRICAL ENGINEERING
ELECTRICAL ENGINEERING DEPARTMENT

A system is said to be causal if the output at index n0 depends only on the input up to and
including the index no; that is output does not depend on thefuture values of the input. An
LTI system is causal if and only if the impulse response is:

1. Linearity and Non-Linearity


We now investigate the linearity property of a causal system of
described by following equation

y[n]−0.4 y[n−1]+0.75 y[n−2] = 2.2403 x[n]+2.4908 x[n−1]+2.2403 x[n−2]

Following program simulates the above-mentioned equation.

clear all,

close all

n = 0:40;

a = 2;

b = -3;

x1 = cos(2*pi*0.1*n);

x2 = cos(2*pi*0.4*n);x =

a*x1 + b*x2;
num = [2.2403 2.4908 2.2403];
den = [1 -0.4 0.75];

Digital Signal Processing Session:Fall-2019


National University of Modern Languages, Rawalpindi
FACULTY OF ELECTRICAL ENGINEERING
ELECTRICAL ENGINEERING DEPARTMENT

ic = [0 0]; % Set zero initial conditions


y1 = filter(num, den, x1, ic); % Compute the output y1[n]

y2 = filter(num, den, x2, ic); % Compute the output y2[n]

y = filter(num, den, x, ic); % Compute the output y[n]

yt = a*y1 + b*y2;

d = y - yt; % Compute the difference output d[n]


% Plot the outputs and the difference signal

subplot (3,1,1)

stem(n ,y);
ylabel('Amplitude');

title('Output Due to Weighted Input');


subplot(3,1,2)

stem(n ,yt);
ylabel('Amplitude');

title('Weighted Output');
subplot(3,1,3)

stem(n,d);

xlabel('Time index n');


ylabel('Amplitude');
title('Difference Signal');

Question 1: Run above program and compare y[n] obtained with weighted input with yt[n]
obtained by combining the two outputs y1[n] and y2[n] with the same weights. Are these
two sequences equal? Is this system linear?

Digital Signal Processing Session:Fall-2019


National University of Modern Languages, Rawalpindi
FACULTY OF ELECTRICAL ENGINEERING
ELECTRICAL ENGINEERING DEPARTMENT

Exercise 1: Consider another system described by y[n] = x[n] x[n − 1]. Modify given
program to compute the output sequences y1[n], y2[n], and y[n] of the above system.
Compare y[n] with yt[n]. Are these two sequences equal? Is this system linear?

2. Time-Invariant and Time-Varying Systems


We next investigate the time-invariance property. Following Programsimulates
following difference equation

y[n]−0.4 y[n−1]+0.75 y[n−2] = 2.2403 x[n]+2.4908 x[n−1]+2.2403 x[n−2]

Two input sequences x[n] and x[n - D], are generated and correspondingoutput
sequences y1[n], y2[n] are plotted.

close all, clear all


n = 0:40;
D = 10;
a = 3.0;
b = -2;

x = a*cos(2*pi*0.1*n) + b*cos(2*pi*0.4*n);
xd = [zeros(1,D) x];
num = [2.2403 2.4908 2.2403];
den = [1 -0.4 0.75];
ic = [0 0];% Set initial conditions
% Compute the output y[n]
y = filter(num, den, x, ic);
% Compute the output yd[n]
yd = filter(num, den, xd, ic);% Compute the difference output d[n]

d = y - yd(1+D:41+D);% Plot the outputs

subplot(3,1,1)

Digital Signal Processing Session:Fall-2019


National University of Modern Languages, Rawalpindi
FACULTY OF ELECTRICAL ENGINEERING
ELECTRICAL ENGINEERING DEPARTMENT

stem(n,y);

ylabel('mplitude');
title('Output y[n]');

grid;

subplot(3,1,2)
stem(n,yd(1:41));
ylabel('Amplitude');

title(['Output Due to Delayed Input x[n , num2str(D),]']);


grid;

subplot(3,1,3) stem(n,d);
xlabel('Time index n');

ylabel('Amplitude'); title('Difference

Signal');grid;

Exercise 2: Consider another system described by:

y[n] = nx[n] + x[n − 1]

Modify Program to simulate the above system and determine whether thissystem is
time-invariant or not.

Lab Task: Perform Exercise 1 and Exercise 2 and prepare a lab report on it!

Digital Signal Processing Session:Fall-2019

You might also like