LAB 6 - Analysis of LTI Systems in the z-Domain
LAB 6 - Analysis of LTI Systems in the z-Domain
LAB 6 - Analysis of LTI Systems in the z-Domain
Instructions:
• All tasks must be completed in this lab session for full credit.
• Students must show the output and MATLAB code for each task to the
instructor before proceeding to the next task.
References:
The 𝑧-transform of the impulse response of an LTI system is called the system function, which is defined as
𝐻 𝑛
, 𝑟ℎ1 < |𝑧| < 𝑟ℎ2. (1)
𝑛=−∞
Using the convolution property of the 𝑧-transform, the output of the LTI system is represented in the 𝑧-domain
as
where 𝑌(𝑧) and 𝑋(𝑧) are the 𝑧-transforms of the output 𝑦[𝑛] and input 𝑥[𝑛] of the system respectively.
When LTI systems are described by a difference equation
𝑁 𝑀
the system function 𝐻(𝑧) can easily be computed. Taking the 𝑧-transform of both sides, and using properties
of the 𝑧-transform,
𝑁 𝑀
or
where 𝑧𝑘’s are the system zeros and 𝑝𝑘’s are the system poles. Thus 𝐻(𝑧) (and hence an LTI system) can also
be represented in the 𝑧-domain using a pole-zero plot. This fact is useful in designing simple filters by proper
placement of poles and zeros.
To determine zeros and poles of a rational 𝐻(𝑧), we can use the MATLAB function roots on both the
numerator and the denominator polynomials. (Its inverse function poly determines polynomial coefficients from
its roots.) It is also possible to use MATLAB to plot these roots for a visual display of a pole-zero plot. The
function zplane(b, a) plots poles and zeros, given the numerator row vector b and the denominator row vector
a. As before, the symbol o represents a zero and the symbol x represents a pole. The plot includes the unit circle
for reference. Similarly, zplane(z, p) plots the zeros in column vector z and the poles in column vector p. Note
very carefully the form of the input arguments for the proper use of this function.
2
𝐻(𝜔) = 𝑏0𝑒𝑗(𝑁−𝑀)𝜔 . (6)
The factor (𝑒𝑗𝜔 − 𝑧𝑘) can be interpreted as a vector in the complex 𝑧-plane from a zero 𝑧𝑘 to the unit circle at
𝑧 = 𝑒𝑗𝜔, while the factor (𝑒𝑗𝜔 − 𝑝𝑘) can be interpreted as a vector from a pole 𝑝𝑘 to the unit circle at 𝑧
= 𝑒𝑗𝜔. This is shown in Figure 1. Hence, the magnitude response function
∏𝑀𝑘=1|𝑒𝑗𝜔 − 𝑧𝑘|
|𝐻(𝜔)| = |𝑏0| ∏ 𝑁𝑘=1 |𝑒𝑗𝜔 − 𝑝𝑘|
of vectors from the poles to the unit circle and scaled by |𝑏0|. Similarly, the phase response function
can be interpreted as a product of the lengths of vectors from the zeros to the unit circle divided by the lengths
𝑀 𝑀
can be interpreted as a sum of a constant factor, a linear-phase factor, and a nonlinear-phase factor (sum of
angles from the “zero vectors” minus the sum of angles from the “pole vectors”).
[H, w] = freqz(b, a, N)
which returns the N-point frequency vector w and the N-point complex frequency response vector H of the
system, given its numerator and denominator coefficients in vectors b and a. The frequency response is
3
evaluated at N points equally spaced around the upper half of the unit circle. Note that the b and a vectors are
the same vectors we use in the filter function or derived from the difference equation representation in (3).
uses N points around the whole unit circle for computation. In yet another form,
H = freqz(b, a, w)
returns the frequency response at frequencies designated in vector w, normally between 0 and π.
Task 1
2. Plot the magnitude and phase response of 𝐻(𝜔), in the space given below.
You may use the following MATLAB code, which will take 100 points along the upper half of the circle.
4
>> [H, w] = freqz(b, a, 100); magH = abs(H); phaH = angle(H);
>> subplot(2,1,1);
>> plot(w/pi, magH); grid
>> title(’Magnitude Response’); ylabel(’Magnitude’);
>> subplot(2,1,2);
>> plot(w/pi, phaH/pi); grid
>> xlabel(’Frequency in \pi Units’); ylabel(’Phase in \pi Units’);
>> title(’Phase Response’)
If you study these plots carefully, you will observe that the plots are computed between 0 ≤ 𝜔 ≤
0.99𝜋 and fall short at 𝜔 = 𝜋. This is due to the fact that in MATLAB the lower half begins at 𝜔
= 𝜋. To overcome this problem, we will use the second form of the freqz function as follows.
Now the 101st element of the array H will correspond to 𝜔 = 𝜋. A similar result can be obtained using
the third form of the freqz function.
Note that in the plots we divided the w and phaH arrays by pi so that the plot axes are in the units of 𝜋
Code:
b = [0.2];
a = [1 -0.9];
[H, w] = freqz(b, a, 100);
magH = abs(H);
phaseH = angle(H);
subplot(3, 1, 1);
plot(w/pi, magH);
grid on;
title('Magnitude Response');
xlabel('Frequency (\pi units)');
ylabel('Magnitude');
subplot(3, 1, 2);
plot(w/pi, phaseH/pi);
grid on;
title('Phase Response');
xlabel('Frequency (\pi units)');
ylabel('Phase (radians/\pi)');
[h, n] = impz(b, a, 100);
subplot(3, 1, 3);
stem(n, h, 'filled');
grid on;
title('Impulse Response h[n]');
xlabel('Samples (n)');
5
ylabel('Amplitude');
n = 0:10;
x = (0.8).^n;
xic = [0.5];
y1 = filter(b, a, x, xic);
figure;
stem(n, y1, 'filled');
xlabel('Samples');
ylabel('Magnitude');
title('System Response to x[n]');
grid on;
System Response:
6
1.2 CAUSALITY AND STABILITY
An LTI system is called causal if its impulse response is a causal sequence, i.e., ℎ[𝑛] = 0, 𝑛 < 0.
Hence, a causal LTI system has a system function, 𝐻(𝑧), whose ROC is the exterior of a circle of some
•
|𝑧| , including 𝑧
radius
.
• An LTI system is called bounded-input, bounded-output (BIBO) stable if its impulse response is
absolutely summable, i.e., . Since
⇒ |𝐻 ,
𝑘
the ROC of the system function, 𝐻(𝑧), of a BIBO stable system always contains the unit circle.
𝑋 . (7)
𝑛
Since the ones-sided 𝑧-transform is given by the two-sided 𝑧-transform of a causal sequence, its ROC is always
the exterior of a circle of some radius |𝑧| , including 𝑧 .
𝑍 . (8)
𝑛 𝑚 𝑘 𝑚 𝑘
This is a useful result which makes the one-sided 𝑧-transform a very useful tool for the solution of LTI systems,
represented by difference equations, that are initially non-relaxed, i.e., that have non-zero initial conditions.
7
Assuming the system is described by the difference equation in (3), the one-sided 𝑧-transform becomes
𝑁 𝑘 𝑀
𝑌 ,
𝑘 𝑛 𝑘
where we have put 𝑋+(𝑧) = 𝑋(𝑧) for causal input sequences. Simplifying, the 𝑧-domain representation of
the system becomes
∑𝑀
𝑘=1 𝑏𝑘 𝑧 𝑘
−
− ∑�=1 𝑎𝑘𝑧 ∑𝑛𝑘=1 𝑦[−𝑛] 𝑧𝑛
−𝑘
𝑋𝐼𝐶
(�
)= −𝑘 � (�
)+ = �⏟ (�
)� (�)
𝑘
1 + ∑�=1 𝑎𝑘� 1 + ∑�𝑘=1
−𝑘
�
(𝑧)
𝑌
� � �� � � �� �
, (9)
�
𝑘 𝑎𝑘𝑧 𝑌𝑍𝑆 ⏟𝐴
𝑌𝑍𝐼
where 𝐻(𝑧) is defined in (4). From (9), we observe that the output of the system with non-zero initial
conditions can be divided into two parts:
is the response of the system that depends only on the input sequence and hence, is called the zero-state
response.
• Zero-input response:-
input response. 𝑋𝐼𝐶(𝑧) is determined by the initial conditions of the system and the input sequence.
is the response of the system that depends on the initial conditions of the system and hence, is called the zero-
• Natural response:- It is the response of the system due to the poles of the system.
• Forced response:- It is the response of the system due to the poles of the input sequence.
From (11), we note that the initial conditions only change the natural response of the system.
8
We have used the filter function to solve the difference equation, given its coefficients and an input. This
function can also be used to find the complete response when initial conditions are given. In this form, the filter
function is invoked by
y = filter(b, a, x, xic)
where xic is the equivalent initial-condition input, derived from the inverse 𝑧-transform of 𝑋𝐼𝐶(𝑧).
subject to 𝑦[−1] = 4, 𝑦[−2] = 10, where 𝑥[𝑛] = 0.8𝑛𝑢[𝑛]. The complete response of the system can be
found by using the following MATLAB script (the elements of vector xic have been computed analytically)
where b and a are the row vectors of coefficients of the difference equation representation of the system.
MATLAB provides a function called filtic, which is available only in the Signal Processing toolbox, to compute
the equivalent initial-condition input xic. It is invoked by
xic = filtic(b, a, Y, X)
9
Task 2
Compute the response of the system given in the example above (analytically) using one-sided 𝑧-transform and
its partial-fraction expansion. Validate your result using MATLAB as well.
10
Matlab Code:
a = [1, 1/2, -1/4];
b = [1, 1/2];
n = 0:20;
x = 0.8.^n;
y0 = [4, 10];
y = filter(b, a, x, y0);
stem(n, x);
hold on;
stem(n, y, 'r', 'filled');
xlabel('n');
ylabel('Amplitude');
legend('Input x[n]', 'Output y[n]');
title('Input and Output Signals');
11
Code:
b = [1/2, 1, 3/2]; % Filter coefficients
figure;
subplot(2, 1, 1);
plot(w/pi, abs(H));
xlabel('Normalized Frequency (pi)');
ylabel('Magnitude');
title('Magnitude Response');
subplot(2, 1, 2);
plot(w/pi, angle(H));
xlabel('Normalized Frequency (pi)');
ylabel('Phase (radians)');
title('Phase Response');
n = 0:199;
x = sin(pi*n/2) + 5*cos(pi*n);
y = filter(b, 1, x);
figure;
subplot(2, 1, 1);
stem(n, x, 'filled');
xlabel('n');
ylabel('x[n]');
title('Input Signal');
subplot(2, 1, 2);
stem(n, y, 'filled');
xlabel('n');
ylabel('y[n]');
title('Output 1 Signal');
12
13
samples by exciting the system with 𝑥[𝑛] = 0.6𝑛 𝑢[𝑛 + 1].
1. Solve the following difference equation and compare your answer with MATLAB for the first 20
Matlab response:
Code:
b = [1 0.5];
a = [1 0.5 -0.25];
n = 0:10;
x = (0.8).^n;
xic = [4, 10];
y = filter(b, a, x, xic);
stem(n, y,'filled');
xlabel('n');
ylabel('y[n]');
title('System Response y[n]');
14
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: