Handout - 5 The Z-Transform

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

Digital Signal Processing

Using Matlab

The z-Transform
Overview
• Introduction
• Definition of the z-transform
• 3D Visualization of the z-Transform
• Properties of the ROC
• Common z-Transform Pairs
• Properties of the z-Transform
• The Inverse z-Transform
• System representation in the z-domain
Introduction
• The discrete-time Fourier transform (DTFT) approach represents
discrete signals and systems using complex exponential
sequence

𝑋 𝜔 = ෍ 𝑥[𝑛]𝑒 −𝑗𝜔𝑛
𝑛=−∞
• However, in order for the DTFT to converge (exist), it is
necessary for the represented signal or system to be absolutely
summable.
• In practice, there are many useful signals for which the DTFT
does not exist because they are not absolutely summable.
• Furthermore, the transient response of a system due to initial
conditions or due to changing inputs cannot be computed using
the DTFT approach.
Definition of the z-transform
• To address the previous two problems, z-transform is proposed
as a generalization of the DTFT.
• The z-transform of a signal 𝑥[𝑛] is defined as

𝑋 𝑧 = 𝑍 𝑥[𝑛] = ෍ 𝑥[𝑛]𝑧 −𝑛
𝑛=−∞

• The variable z is complex: 𝑧 = Re 𝑧 + 𝑗Im 𝑧 = 𝑟𝑒 𝑗𝜔


where 𝑟 = 𝑧
• The set of z values for which 𝑋(𝑧) converges (exists) is called
the region of convergence (ROC).
Definition of the z-transform
• The function 𝑧 = 1 (or 𝑧 = 𝑒 𝑗𝜔 )
is a circle of unit radius in the z-
plane and is called the unit circle.
• If the ROC contains the unit circle,
then the z-transform evaluated on
the unit circle corresponds to the
DTFT, or

𝑋 𝜔 = ෍ 𝑥[𝑛]𝑒 −𝑗𝜔𝑛 = 𝑋(𝑧)ቚ


𝑧=𝑒 𝑗𝜔
𝑛=−∞ Unit circle
• Therefore the DTFT may be viewed
as a special case of the z-transform. The z-plane
Examples
Example (1):
Find the z-transform for the sequence 𝑥[𝑛] = 𝑎𝑛 𝑢[𝑛]
Solution:
∞ ∞ ∞

𝑋 𝑧 = ෍ 𝑥[𝑛]𝑧 −𝑛 = ෍ 𝑎𝑛 𝑢[𝑛]𝑧 −𝑛 = ෍ (𝑎𝑧 −1 )𝑛


𝑛=−∞ 𝑛=−∞ 𝑛=0

For 𝑋 𝑧 to converge we require that ෍ (𝑎𝑧 −1 )𝑛 < ∞


𝑛=0

The ROC is thus 𝑎𝑧 −1 < 1 or equivalently 𝑧 > 𝑎 . Then



1 𝑧
𝑋 𝑧 =෍ (𝑎𝑧 −1 )𝑛 = −1 = ; 𝑧 > 𝑎
1 − 𝑎𝑧 𝑧−𝑎
𝑛=0
Examples
𝑧
𝑋 𝑧 =
𝑧−𝑎

has one zero at 𝑧 = 0


and one pole at 𝑧 = 𝑎

This figure shows the 1

ROC and the pole-


zero plot for 𝑿 𝒛 for
example (1).
The zero is indicated
by the “O” symbol
while the pole is
indicated by the “X”
symbol.
The z-plane
Examples
Example (2):
Find the z-transform for the sequence 𝑥[𝑛] = −𝑎𝑛 𝑢[−𝑛 − 1]
Solution:
∞ −1 ∞

𝑋 𝑧 = ෍ 𝑥[𝑛]𝑧 −𝑛 = − ෍ 𝑎𝑛 𝑧 −𝑛 = − ෍ 𝑎−1 𝑧 𝑛

𝑛=−∞ 𝑛=−∞ 𝑛=1

= 1 − σ∞ −1
𝑛=0 𝑎 𝑧
𝑛

For 𝑋 𝑧 to converge we require that ෍ 𝑎−1 𝑧 𝑛 <∞


𝑛=1

The ROC is thus 𝑎−1 𝑧 < 1 or equivalently 𝑧 < 𝑎 . Then


𝑎−1 𝑧 1 𝑧
𝑋 𝑧 =− −1
= −1
= 𝑧 < 𝑎
1 − 𝑎 𝑧 1 − 𝑎𝑧 𝑧−𝑎
Examples

This figure shows the


ROC and the pole-
zero plot for 𝑋 𝑧 in
example (2).
The z-plane is similar
to the previous
example (1) except
for the ROC. Thus the
z-transform is not
uniquely defined until
its ROC has been
specified.

The z-plane
3D Visualization of the z-Transform
𝑧
𝐻 𝑧 =
𝑧 − 0.5
30

20

20 log |H(z)|, dB
10

-10

-20

-30
2
1 2
0 1
Im{z} 0
-1 Re{z}
-1
-2 -2 z-plane
Properties of the ROC
1. The z-transform of a sequence consists of an algebraic formula
and its associated ROC. Thus, to uniquely specify a sequence
𝑥[𝑛] we need both 𝑋 𝑧 and its ROC.
2. The function 𝑋 𝑧 is not defined when z is outside the ROC,
even if the formula for 𝑋 𝑧 yields meaningful results for these
values.
3. The ROC does not contain any poles (a pole means 𝑋 𝑧 = ∞).
4. The ROC is one contiguous region and does not come in pieces.
5. If 𝑋 𝑧 is a rational function, there will be at least one pole on
the boundary of the ROC.
Properties of the ROC
6. If the signal is finite-length (i.e., 𝑥[𝑛] = 0 except for 𝑛1 ≤ 𝑛 ≤
𝑛2 ), the ROC is the entire z-plane.
If 𝑛1 < 0, then 𝑧 = ∞ is not in the ROC.
If 𝑛2 > 0, then 𝑧 = 0 is not in the ROC.
7. If the signal is right-sided (i.e., 𝑥[𝑛] = 0 for 𝑛 < 𝑛0 )
the ROC is the exterior of a circle: 𝑧 > 𝛼
(if 𝑛0 ≥ 0, therefore 𝑥[𝑛] is a causal sequence)
8. If the signal is left-sided (i.e., 𝑥[𝑛] = 0 for 𝑛 > 𝑛0 )
the ROC is the interior of a circle: 𝑧 < 𝛽
(if 𝑛0 ≤ 0, therefore 𝑥[𝑛] is an anticausal sequence)
9. If the signal is two-sided
the ROC is an open ring: 𝛼 < 𝑧 < 𝛽
Common z-Transform Pairs

h [𝑛] = 3 δ[n + 2] therefore H(z) =3 z2


Properties of the z-Transform
Examples
𝑧 −2
Example (3): , 𝑢[𝑛 − 2]=1−𝑧 −1
Example (4):

Example (5):
1
𝑎𝑛 𝑢[𝑛]=1−𝑎𝑧 −1
Examples**

Note: 𝑢 𝑛 , 𝑢 𝑛 − 1 , 𝑎𝑛 𝑢 𝑛 , (𝑎−1 )𝑛 𝑢 𝑛 , 𝑎−𝑛 𝑢 −𝑛


Examples

1
Note: 𝑍{𝑎𝑛 𝑢 𝑛 } = 1−𝑎𝑧 −1
1
𝑍{(𝑎−1 )𝑛 𝑢 𝑛 } = 1−𝑎−1 𝑧 −1
1
𝑍{(𝑎−1 )−𝑛 𝑢 −𝑛 } = 1−𝑎−1𝑍
The Inverse z-Transform
Method A: Inversion Formula

1
𝑥[𝑛] = ර 𝑋(𝑧) 𝑧 𝑛−1 𝑑𝑧
2𝜋𝑗 𝐶
This, in general, is a complicated procedure.

Method B: Use of Tables


In this method we attempt to express 𝑋(𝑧) as a sum of known
inverse transforms
𝑋 𝑧 = 𝑋1 𝑧 + ⋯ + 𝑋𝑚 (𝑧).
Then we use the earlier tables for z-transform pairs and properties
to find 𝑥[𝑛].
The Inverse z-Transform
Method C: Power Series Expansion
If we can express 𝑋 𝑧 as a power series in the form
𝑋 𝑧 = ⋯ + 𝑥[−2]𝑧 2 + 𝑥[−1]𝑧 + 𝑥[0] + 𝑥[1]𝑧 −1 + 𝑥[2]𝑧 −2 + ⋯
then we can determine any particular value 𝑥[𝑛] by finding the
coefficient of the appropriate power of 𝑧 −1 . This method is useful
for finite-length sequences.
Example: X(n) = {4,5,6} therefore x(z)= 4z + 5 +6z-1

Method D: Partial Fraction Expansion


This is the most practical approach. The z-transform in this
method must be a rational function. This requirement is generally
satisfied in digital signal processing.
The Inverse z-Transform
Method D: Partial Fraction Expansion (cont.)
For z-transform that is rational function of z

(𝑧 − 𝑧1 ) ⋯ (𝑧 − 𝑧𝑙 ) ς𝑙𝑘=1 𝑧 − 𝑧𝑘
𝑋 𝑧 =𝐶 =𝐶 𝑚
(𝑧 − 𝑝1 ) ⋯ (𝑧 − 𝑝𝑚 ) ς𝑘=1 𝑧 − 𝑝𝑘
Assuming that 𝑚 ≥ 𝑙 and that all the roots in the denominator are
simple and distinct (not repeated), 𝑋 𝑧 may be expressed as follows
𝑧 𝑧
𝑋 𝑧 = 𝐴0 + 𝐴1 + ⋯ + 𝐴𝑚
𝑧 − 𝑝1 𝑧 − 𝑝𝑚
where

𝑋(𝑧)
𝐴0 = 𝑋(𝑧)ቚ and 𝐴𝑘 = (𝑧 − 𝑝𝑘 ) ቤ
𝑧=0 𝑧 𝑧=𝑝
𝑘
The Inverse z-Transform
Example:
Find the inverse z-transform of
𝑧
𝑋 𝑧 = 2
3𝑧 − 4𝑧 + 1
Solution:
(1/3)𝑧 (1/3)𝑧 𝑧 𝑧
𝑋 𝑧 = = = 𝐴0 + 𝐴1 + 𝐴2
4 1 1 𝑧−1 1
𝑧2 − 𝑧 + (𝑧 − 1)(𝑧 − ) 𝑧−
3 3 3 3

𝐴0 = 𝑋(𝑧)ቚ =0
𝑧=0

𝑋 𝑧 (1/3) 1
𝐴1 = 𝑧 − 1 ቤ = =
𝑧 𝑧=1 1 ቮ 2
(𝑧 − )
3
𝑧=1
The Inverse z-Transform
1 𝑋 𝑧 (1/3) 1
𝐴2 = 𝑧 − ቤ = ቤ =−
3 𝑧 𝑧=1 (𝑧 − 1) 𝑧=1 2
3 3

Therefore
𝑧 1 𝑧 𝑧
𝑋 𝑧 = 2 = −
3𝑧 − 4𝑧 + 1 2 𝑧 − 1 𝑧 − (1/3)
1
Now, 𝑋 𝑧 has two poles: 𝑝1 = 1 and 𝑝2 = 3 and since the ROC is
not specified, there are three possible ROCs.
• Right-sided sequence
• Left-sided sequence
• Two-sided sequence
The Inverse z-Transform
The Inverse z-Transform
Matlab Implementation
• A Matlab function residuez is available to compute the residue part
and the direct (or polynomial) terms of a rational function in 𝑧 −1 .
• Let
𝑧 𝑧 −1 0 + 𝑧 −1
𝑋 𝑧 = 2 = −1 −2
=
3𝑧 − 4𝑧 + 1 3 − 4𝑧 + 𝑧 3 − 4𝑧 −1 + 𝑧 −2
MATLAB:
>> b = [0, 1];
>> a = [3, -4, 1];
>> [r, p, k] = residuez(b, a)
r=
0.5000
-0.5000 0.5 𝑧 0.5 𝑧
p= 𝑋 𝑧 = −
1.0000 𝑧 − 1 𝑧 − (1/3)
0.3333
k=
[]
Matlab Implementation
• Similarly, [b,a] = residuez(r,p,k) can be used to convert the partial
fraction expansion back to polynomials with coefficients in row
vectors b and a.

MATLAB:
>> r = [0.5, -0.5];
>> p = [1, 1/3];
1
>> k = []; 0 + 3 𝑧 −1 𝑧 −1
>> [b, a] = residuez(r, p, k) 𝑋 𝑧 = =
4 1 3 − 4𝑧 −1 + 𝑧 −2
b= 1 − 3 𝑧 −1 + 3 𝑧 −2
0.0000 𝑧
= 2
0.3333 3𝑧 − 4𝑧 + 1
a=
1.0000
-1.3333
0.3333
System representation in the z-domain
System Function

• Recall that, for a LSI system with a unit sample response ℎ[𝑛], the
output is given by the convolution sum

𝑦[𝑛] = 𝑥[𝑛] ∗ ℎ[𝑛] = ෍ 𝑥 𝑘 ℎ[𝑛 − 𝑘]


𝑘=−∞
• Using the convolution property of the z-transform, we get
𝑌 𝑧 =𝑋 𝑧 𝐻 𝑧 ∶ 𝑅𝑂𝐶𝑦 = 𝑅𝑂𝐶𝑥 ∩ 𝑅𝑂𝐶ℎ

𝐻 𝑧 = 𝑍 ℎ[𝑛] = ෍ ℎ[𝑛]𝑧 −𝑛
𝑛=−∞
• Similar to the frequency response function 𝐻(𝜔), the z-domain
function, 𝐻 𝑧 is called the system function.

X (z ) H (z ) Y ( z) = H ( z) X ( z)
System representation in the z-domain
System Function From Difference Equation
𝑁 𝑀

𝑦[𝑛] + ෍ 𝑎𝑘 𝑦[𝑛 − 𝑘] = ෍ 𝑏𝑚 𝑥[𝑛 − 𝑚]


𝑘=1 𝑚=0

𝑁 𝑀

𝑌 𝑧 + ෍ 𝑎𝑘 𝑧 −𝑘 𝑌 𝑧 = ෍ 𝑏𝑚 𝑧 −𝑚 𝑋 𝑧
𝑘=1 𝑚=0

𝑌(𝑧) σ𝑀
𝑚=0 𝑏𝑚 𝑧
−𝑚
𝑏0 𝑧 −𝑀 ς𝑀
𝑚=1 𝑧 − 𝑧𝑚
𝐻 𝑧 = = 𝑁 = −𝑁
𝑋(𝑧) 1 + σ𝑘=1 𝑎𝑘 𝑧 −𝑘 𝑧 ς𝑁
𝑘=1 𝑧 − 𝑝𝑘

Thus 𝐻(𝑧) can also be represented in the z-plane using a pole-zero plot.
This fact is useful in designing simple filters by proper placement of
poles and zeros.
Matlab Implementation
• To determine zeros and poles of a rational 𝐻 𝑧 you can use Matlab
functions:
roots: polynomial → roots
poly: roots → polynomial
• Also, zplane(b,a) plots the poles and zeros, given the numerator row
vector b and the denominator row vector a.
• Similarly, zplane(z,p) plots the zeros in column vector z and the poles
in the column vector p.
• [H,w]=freqz(b,a,N) returns the N-point frequency vector w and the N-
point complex frequency response vector H of the system.
Example
Consider a causal discrete-time system whose
output y[n] and input x[n] are related by
y[n]-5/6 y[n-1]+1/6 y[n-2]=x[n]
• Find its system function H(z).
• Find its impulse response h[n].
Matlab Implementation
Example

𝑧 𝑧
𝐻 𝑧 = 2 =
3𝑧 − 4𝑧 + 1 3(𝑧 − 1)(𝑧 − 1/3)

MATLAB:
>> b = [0, 1]; a = [3, -4, 1]; 1
>> zplane(b, a); 0.8
>> freqz(b, a); 0.6

Imaginary Part 0.4

0.2

-0.2

-0.4

-0.6

-0.8

-1

-1 -0.5 0 0.5 1
Real Part
Matlab Implementation

Magnitude (dB) 40

20

-20
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

0
Phase (degrees)

-50

-100

-150

-200
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
Relationships between system representation

Express H(z) in
1/z cross H(z) Take inverse z-
multiply and transform
take inverse Take z-transform Take
solve for Y/X z-transform
Difference
h(n)
Equation Substitute
z=ejw Take inverse
DTFT

Take DTFT solve H(ejw)


Take Fourier
for Y/X
transform

The dashed paths exist only if the system is stable


Stability and Causality
z-domain LSI stability:
• An LSI system is stable if and only if the unit
circle is inside the ROC region of H(z).
z-domain causal LSI stability
• A causal LSI system is stable if and only if the
system function H(z) has all its poles inside the
unit circle.
Matlab Commands
filter 1-D digital filter
freqz Frequency response of filter
poly Polynomial with specified roots
polyval Evaluates the value of a polynomial
residuez z-transform partial-fraction expansion
roots Polynomial roots
zplane Zero-pole plot

You might also like