LAB 6 - Analysis of LTI Systems in the z-Domain

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

Name: Muhammad Jahanzeb

Roll No: 0032-Bsc-Engg-EE-21

Analysis of LTI Systems in the 𝑧-Domain


LAB 6

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:

1. Digital Signal Processing using MATLAB: A problem solving companion, Vinay


K. Ingle and John G. Proakis, 4th Edition, Cengage Learning, 2016
2. Discrete Time Signal Processing, Alan. V. Oppenheim and Ronald. W. Schafer,
3rd Edition, Prentice Hall, 2010
3. Digital Signal Processing: Principles, Algorithms, and Applications, John G.
Proakis and Dimitris G. Manolakis, 4th Edition, Prentice Hall, 2007

1. SYSTEM REPRESENTATION IN THE z-DOMAIN

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

𝑌(𝑧) = 𝐻(𝑧) 𝑋(𝑧), ROC𝑦: ROCℎ ∩ ROC𝑥, (2)

where 𝑌(𝑧) and 𝑋(𝑧) are the 𝑧-transforms of the output 𝑦[𝑛] and input 𝑥[𝑛] of the system respectively.
When LTI systems are described by a difference equation

𝑁 𝑀

𝑦[𝑛] + ∑ 𝑎𝑘𝑦[𝑛 − 𝑘] = ∑ 𝑏𝑘𝑥[𝑛 − 𝑘], (3)


𝑘=1 𝑘=0

the system function 𝐻(𝑧) can easily be computed. Taking the 𝑧-transform of both sides, and using properties
of the 𝑧-transform,

𝑁 𝑀

𝑌(𝑧) + ∑ 𝑎𝑘𝑧−𝑘 𝑌(𝑧) = ∑ 𝑏𝑘𝑧−𝑘 𝑋(𝑧)


𝑘=1 𝑘=1

or

𝑌(𝑧) ∑𝑀𝑘=1 𝑏𝑘𝑧−𝑘 𝐵(𝑧)


𝐻(𝑧) ≜ 𝑋 (𝑧) = 1 +
∑𝑁 𝑎𝑘𝑧−𝑘 = 𝐴(𝑧)
(4) 𝑘=1

After rearrangement and factorization, the system function can be written as

𝐻(𝑧) = 𝑏0𝑧𝑁−𝑀 𝑧 𝑀 + (𝑏1𝑧/𝑁𝑏0+)𝑧𝑎𝑀1−𝑧1𝑁−


+1(+𝑏2𝑎/2𝑏𝑧0𝑁)−𝑧2𝑀+−2⋯++⋯𝑎+𝑁(𝑏𝑀/𝑏0) = 𝑏0𝑧𝑁−𝑀 ∏𝑘𝑀=1(𝑧 − 𝑧𝑘) (5)

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.

1.1 TRANSFER FUNCTION REPRESENTATION


If the ROC of 𝐻(𝑧) includes a unit circle (𝑧 = 𝑒𝑗𝜔), then we can evaluate 𝐻(𝑧) on the unit circle, resulting
in a frequency response function or transfer function 𝐻(𝜔). Then from (5),

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

Figure 1: Pole-zero plot (figure taken from ref. [1]).

𝑀 𝑀

∠𝐻(𝜔) = [0 or 𝜋] + [(𝑁 − 𝑀)𝜔] + ∑ ∠(𝑒𝑗𝜔 − 𝑧𝑘) − ∑ ∠(𝑒𝑗𝜔 − 𝑝𝑘)


𝑘=1 𝑘=1

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”).

1.1.1 MATLAB IMPLEMENTATION


MATLAB provides a function called freqz for the computation of magnitude and phase responses of a system.
In its simplest form, this function is invoked by

[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).

The second form

[H, w] = freqz(b, a, N, ’whole’)

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

Consider the causal system 𝑦[𝑛] = 0.9𝑦[𝑛 − 1] + 2𝑥[𝑛].


1. Determine 𝐻(𝑧) (analytically) and sketch its pole-zero plot in the space given below.

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.

>> [H, w] = freqz(b, a, 200, ‘whole’);


>> magH = abs(H(1 : 101)); phaH = angle(H(1 : 101));

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.

>> w = [0 : 1 : 100]*pi/100; H = freqz(b, a, w);


>> magH = abs(H); phaH = angle(H);

Note that in the plots we divided the w and phaH arrays by pi so that the plot axes are in the units of 𝜋

Determine the impulse response ℎ[𝑛].


and easier to read. This practice is strongly recommended.
3.

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.

always lie inside the unit circle in the 𝑧-plane.


• From the above discussion, it can be concluded that the poles of a causal and (BIBO) stable LTI system

2. SOLUTION OF THE DIFFERENCE EQUATIONS


In digital signal processing, difference equations generally evolve in the positive 𝑛 direction. Therefore, our
time frame for these solutions will be 𝑛 . For this purpose, we define a version of the bilateral z-transform
called the one-sided 𝑧-transform.

2.1 THE ONE-SIDED 𝑧-TRANSFORM


The one-sided 𝑧-transform of a sequence 𝑥[𝑛] is given
by

𝑋 . (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 𝑧 .

The sample shifting property of the one-sided 𝑧-transform is given by

𝑍 . (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.

2.2 RESPONSE OF A SYSTEM WITH 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:

𝑌𝑍𝑆(𝑧) = 𝐻(𝑧)𝑋(𝑧) (10)


• Zero-state response:-

is the response of the system that depends only on the input sequence and hence, is called the zero-state
response.

• Zero-input response:-

𝑌𝑍𝐼(𝑧) = 𝑋 𝐴𝐼𝐶((𝑧𝑧)) (11)

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-

Moreover, the response of the system can further be classified as:

• 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.

as 𝑛 approaches and is called the transient response of the system.


• Transient response:- If the poles of the system lie inside the unit circle, then the natural response dies out

persists for all 𝑛


• Steady-state response:- If the poles of the input sequence lie on the unit circle, the forced response
and is called the steady-state response of the system.

From (11), we note that the initial conditions only change the natural response of the system.

2.2.1 MATLAB IMPLEMENTATION

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 𝑋𝐼𝐶(𝑧).

Example Consider the difference equation

𝑦[𝑛] + 𝑦[𝑛 − 1] − 𝑦[𝑛 − 2] = 𝑥[𝑛] + 𝑥[𝑛 − 1],𝑛 ≥ 0,

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)

>> n = [0 : 10]; x = (0.8).ˆn; xic = [0.5, 1];


>> y1 = filter(b, a, x, xic);

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)

conditions on 𝑦[𝑛] and 𝑥[𝑛], respectively, in the form


in which b and a are the filter coefficient arrays and Y and X are the initial-condition arrays from the initial

Y = [y(−1), y(−2), . . . , y(−N)]


X = [x(−1), x(−2), . . . , x(−M)]

If 𝑥[𝑛] = 0, 𝑛 ≤ −1, then X need not be specified in the filtic function.

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

w = linspace(0, pi, 1000); % Frequency vector


[H, w] = freqz(b, 1, w);

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

𝑦[𝑛] = 0.64𝑦[𝑛 − 2] + 𝑥[𝑛] + 𝑥[𝑛 − 1], 𝑛 ≥ 0, 𝑦[−1] = 1, 𝑦[−2] = 2.

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy