New Era University: College of Engineering and Architecture Department of Electronics Engineering
New Era University: College of Engineering and Architecture Department of Electronics Engineering
RATING
Understanding Discrete-Time Systems using MATLAB
Theory:
A discrete-time system processes an input signal in the time-domain to generate an output signal with more
desirable properties by applying an algorithm composed of simple operations on the input signal and its delayed
versions.
Objective:
To illustrate the simulation of some simple discrete-time systems on the computer using MATLAB and
investigate their time domain properties.
For a linear discrete-time system , if y1[n] and y2[n] are the responses to the input sequences x1[n] and x2[n],
respectively, then for an input:
The superposition property of the second equation must hold for any arbitrary constants α and β and for all
possible inputs x1[n] and x2[n]. If it does not hold for at least one set of nonzero values of α and β, or one set of
nonzero input sequences x1[n] and x2[n], then the system is nonlinear.
To solve a linear system, we use the “forward slash” command “\”. For example to solve
we do
Note: We can format the output by using the MATLAB command “format”. Use the command “format short and
format long, respectively. Observe what will happen. Include this in your command to display the result.
Exercise:
is of order n = 3 with unknowns x1, x2 and x3. The matrix-vector form of this linear system is Ax = b where
As will be verified later, this linear system has precisely one solution, given by x 1 = 1, x2 = 1 and x3 = 1, so the
solution vector is:
2. Consider the linear system given above. If the coefficient matrix A remains unchanged, then what choice
A linear time-invariant (LTI) discrete-time system satisfies both the linearity and the time-invariance
properties.
If y1[n] and y2[n] are the responses of a causal discrete-time system to the inputs u1[n] and u2[n],
respectively, then
u1[n] = u2[n] for n < N
implies also that
The response of a discrete-time system to a unit sample sequence {δ[n]} is called the unit sample
response or, simply, the impulse response , and denoted as {h[n]}. Correspondingly, the response of a
discrete-time system to a unit step sequence {μ[n]}, denoted as {s[n]}, is its unit step response or, simply
the step response.
An LTI discrete-time system is causal if and only if its impulse response sequence {h[n]} satisfies the
condition
h[k] = 0 for k < 0.
Exercise:
generate three different input sequences x1[n], x2[n], and x[n] = a · x1[n]+b · x2[n], and to compute and plot the
corresponding output sequences y1[n], y2[n], and y[n] using the MATLAB codes given below.
DSP_4_1
% Program DSP_4_1
% Generate the input sequences
clf;
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];
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: a \cdot+ x_{1}+[n] + b \cdot+ x_{2}+[n]’);
subplot(3,1,2)
stem(n,yt);
ylabel(‘Amplitude’);
title(‘Weighted Output: a \cdot+ y_{1}+[n] + b \cdot+ y_{2}+[n]’);
subplot(3,1,3)
stem(n,d);
xlabel(‘Time index n’); ylabel(‘Amplitude’);
title(‘Difference Signal’);
1. Run Program DSP_4_1 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?
The two sequences are not equal.
Yes, they are linear because the graph shows the responses of the inputs, which gave an output that is
not equal to the input.
2. Repeat Question 1 for three different sets of values of the weighting constants, a and b, and three
different sets of input frequencies.
3. Consider another system described by:
y[n] = x[n]+ x[n − 1]
Modify Program DSP_4_1 to compute the output sequences y 1[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?
No, they are not equal. Yes, the system is linear.