Professional Documents
Culture Documents
In [ ]:
cd matlab
pwd
This session we will talk about the Inverse Z-Transform and illustrate its use through an examples class.
The material in this presentation and notes is based on Chapter 9 (Starting at Section 9.6) of Steven T.
Karris, Signals and Systems: with Matlab Computation and Simulink Modelling, 5th Edition.
(http://site.ebrary.com/lib/swansea/docDetail.action?docID=10547416) from the Required Reading List.
Agenda
Inverse Z-Transform
Analysis in Matlab
r1 z r1 z r3 z
k, , , ,…
2
z − p1 (z − p1 ) z − p2
where k is a constant, and r i and pi represent the residues and poles respectively, and can be real or
complex1.
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 1/15
23/04/2018 i-z-transform
Notes
F (z) k r1 r2
= + + + ⋯
z z z − p1 z − p2
F (z) F (z) ∣
r k = lim (z − pk ) = (z − pk ) ∣
z→p
k z z ∣z=p
k
F (z) r1 z r2 z
z = F (z) = k + + + ⋯
z s − p1 s − p2
Example 1
Karris Example 9.4: use the partial fraction expansion to compute the inverse z-transform of
1
F (z) =
−1 −1 −1
(1 − 0.5z )(1 − 0.75z )(1 − z )
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 2/15
23/04/2018 i-z-transform
Matlab solution
See example1.mlx (https://github.com/cpjobling/EG-247-
Resources/blob/master/week9/matlab/example1.mlx). (Also available as example1.m
(https://github.com/cpjobling/EG-247-Resources/blob/master/week9/matlab/example1.m).)
In [15]:
syms z n
In [16]:
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 3/15
23/04/2018 i-z-transform
In [17]:
Dz_poly = collect(Dz)
Dz_poly =
2
z
In [18]:
3 2
z − 9/4z − 13/8z − 3/8
In [19]:
den = sym2poly(Dz_poly)
den =
In [20]:
[r,p,k] = residue(num,den);
Print results
fprintf works like the c-language function
In [21]:
fprintf('\n')
fprintf('r1 = %4.2f\t', r(1)); fprintf('p1 = %4.2f\n', p(1));...
fprintf('r2 = %4.2f\t', r(2)); fprintf('p2 = %4.2f\n', p(2));...
fprintf('r3 = %4.2f\t', r(3)); fprintf('p3 = %4.2f\n', p(3));
r1 = 8.00 p1 = 1.00
r2 = -9.00 p2 = 0.75
r3 = 2.00 p3 = 0.50
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 4/15
23/04/2018 i-z-transform
Symbolic proof
n n
1 3
f [n] = 2 − 9 + 8
(2) (4)
In [22]:
% z-transform
fn = 2*(1/2)^n-9*(3/4)^n + 8;
Fz = ztrans(fn)
Fz =
In [23]:
% inverse z-transform
iztrans(Fz)
ans =
2*(1/2)^n - 9*(3/4)^n + 8
Sequence
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 5/15
23/04/2018 i-z-transform
In [24]:
n = 1:15;
sequence = subs(fn,n);
stem(n,sequence)
title('Discrete Time Sequence f[n] = 2*(1/2)^n-9*(3/4)^n + 8');
ylabel('f[n]')
xlabel('Sequence number n')
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 6/15
23/04/2018 i-z-transform
Example 2
Karris example 9.5: use the partial fraction expansion method to to compute the inverse z-transform of
12z
F (z) =
2
(z + 1)(z − 1)
Matlab solution
See example2.mlx (https://github.com/cpjobling/EG-247-
Resources/blob/master/week9/matlab/example2.mlx). (Also available as example2.m
(https://github.com/cpjobling/EG-247-Resources/blob/master/week9/matlab/example2.m).)
dimpulse – computes and plots a sequence f [n] for any range of values of n
In [25]:
open example2
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 7/15
23/04/2018 i-z-transform
Results
'Lollipop' Plot
'Staircase' Plot
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 8/15
23/04/2018 i-z-transform
Example 3
Karris example 9.6: use the partial fraction expansion method to to compute the inverse z-transform of
z + 1
F (z) =
2
(z − 1)(z + 2z + 2)
Matlab solution
See example3.mlx (https://github.com/cpjobling/EG-247-
Resources/blob/master/week9/matlab/example3.mlx). (Also available as example3.m
(https://github.com/cpjobling/EG-247-Resources/blob/master/week9/matlab/example3.m).)
In [26]:
open example3
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 9/15
23/04/2018 i-z-transform
Results
Lollipop Plot
Staircase Plot
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 10/15
23/04/2018 i-z-transform
1 n−1
f [n] = F (z)z dz
j2π ∮ C
See Karris Section 9.6.2 (pp 9-29—9-33) if you want to find out more.
Example 4
Karris example 9.9: use the long division method to determine f [n] for n = 0, 1, and 2 , given that
−1 −2 −3
1 + z + 2z + 3z
F (z) =
−1 −1 −1
(1 − 0.25z )(1 − 0.5z )(1 − 0.75z )
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 11/15
23/04/2018 i-z-transform
Matlab
See example4.mlx (https://github.com/cpjobling/EG-247-
Resources/blob/master/week9/matlab/example4.mlx). (also available as example4.m
(https://github.com/cpjobling/EG-247-Resources/blob/master/week9/matlab/example4.m).)
In [27]:
open example4
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 12/15
23/04/2018 i-z-transform
Results
sym_den =
fn =
1.0000
2.5000
5.0625
....
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 13/15
23/04/2018 i-z-transform
Partial
Most familiar. Requires that F (z) is a proper
Fraction
Can use Matlab `residue` function. rational function.
Expansion
Summary
Inverse Z-Transform
Examples using PFE
Examples using Long Division
Analysis in Matlab
Next time
DT transfer functions, continuous system equivalents, and modelling DT systems in Matlab and
Simulink.
Answers to Examples
Answer to Example 1
n n
1 3
f [n] = 2 − 9 + 8
(2) (4)
Answer to Example 2
n
f [n] = 3(−1) + 6n − 3
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 14/15
23/04/2018 i-z-transform
Answer to Example 3
n n
(√2
‾) 3nπ 3(√2
‾) 3nπ
f [n] = −0.5δ[n] + 0.4 + cos − sin
10 4 10 4
Answer to Example 4
, ,
f [0] = 1 f [1] = 5/2 f [2] = 81/16 , ....
http://localhost:8888/nbconvert/html/dev/EG-247-Resources/week9/i-z-transform.ipynb?download=false 15/15