5/1/2018 Z Transform 2 of 3
ECET 357 Real-Time Digital Signal Processing
z Transforms
2 of 3
Spring 2007
References
Fundamentals of Digital Signal Processing, 2002, by Joyce Van de Vegte, from Prentice Hall, ISBN 0-13-
016077-6
Topics of Discussion
Laplace Transform - Review
z Transform Basics: x[n] ↔ X(z), y(n) ↔ Y(z)
z Transform
Inverse z Transform
Transfer Functions
Transfer Functions and Difference Equations: H(z) = Output/Input = Y(z)/X(z)
Transfer Functions and Impulse Response: Y(z) = H(z)X(z)
Filter Outputs
Cascade and Parallel Combinations of Transfer Functions
Back to Time Domain
Standard Form
Simple Inverse z Transforms (table)
Inverse z Transform by Long Division
Inverse z Transform by Partial Fraction Expansion
Transfer Functions and Stability
Poles and Zeros
Stability (z-plane), unit circle
First Order Systems
Second Order Systems
Transfer Functions
Transfer Functions and Difference Equations
Given a general difference equation
Or
Find the z-transform of each term in the equation, yields
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 1/18
5/1/2018 Z Transform 2 of 3
Factor out Y(z) and X(z) terms, we obtain
Then rearrange the Y(z) and X(z) as follows to obtain the transfer function H(z):
Example 6-8: Find the transfer function of the system described by the difference equation:
Taking the z-transforms term by term, and rearrange Y(z) and X(z) to obtain H(z):
Example 6-10: Find the transfer function for the non-recursive difference equation
Ans:
The transfer function H(z):
Example 6-11: Find the difference equation that corresponds to the transfer function
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 2/18
5/1/2018 Z Transform 2 of 3
Ans:
Cross multiplying Y(z), X(z) with the right-side terms
or
Inversely transform each term to find the difference equation:
Example 6-12: Find the difference equation that matches the transfer function:
Ans:
Multiplying the denominator terms to give
Cross-multiplying then gives
Find inverse transform for each term, to obtain the difference equation:
Multiplying both sides by for an equivalent shifting of [n-2]:
Then find the inverse transform for each term:
Divide every term by 8 to make a0 = 1:
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 3/18
5/1/2018 Z Transform 2 of 3
MATLAB Example
%ex6_12_transferHz.m
% Reference:
% Digital Signal Processing Laboratory using MATLAB, by Sanjit K. Mitra,
% from McGraw-Hill, 1999
%
% y[n] - 0.75y[n-1] + 0.125y[n-2] = 0.125x[n-1]
n = 0:40;
s1 = sin(2*pi*0.1*n);
s2 = sin(2*pi*0.4*n);
x = 2*s1 + (-3)*s2;
num = [0 0.125 0];
den = [1 -0.75 0.125];
IC =[0 0]; % Set zero initial conditions
y1 = filter(num, den, s1,IC); % compute y1[n]
y2 = filter(num, den, s2,IC); % compute y2[n]
y = filter(num, den, x, IC); % compute y[n]
yt = 2*y1 + (-3)*y2;
d = y - yt; % compute difference
subplot(3,1,1), stem(n, y)
subplot(3,1,2), stem(n, yt)
subplot(3,1,3), stem(n,d)
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 4/18
5/1/2018 Z Transform 2 of 3
Transfer Functions and Impulse Responses
A connection between the impulse response and the transfer function:
The z-transform for a causal filter:
Where
Y(z) – the z-transform of y[n]
H(z) – the z-transform of h[n]
X(z) – the z-transform of x[n]
And
The impulse response h[n] is the inverse z-transform of H(z)::
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 5/18
5/1/2018 Z Transform 2 of 3
Example 6.13: The impulse response for a digital filter is
Find the transfer function of the filter.
Ans: Find the z-transform of h[n] to yield H(z):
Also, we can find y[n] through h[n]:
Finding Filter Outputs
In the z-domain, Y(z) = H(z)X(z)
The output y[n] can be obtained from the inverse z-transform as
Cascade and Parallel Combinations of Transfer Functions
Cascade Connected Filters
X(z) -> H1(z) -> H2(z) – Y(z)
Y(z) = (H1(z)H2(z)) X(z)
Parallel Connected Filters
X(z) -> H1(z) -> Y1(z)
X(z) -> H2(z) -> Y2(z)
Y(z) = Y1(z) + Y2(z) = (H1(z) + H2(z)) X(z)
MATLAB Example
Example 6.14: Find the difference equation that corresponds to the cascaded sections of block diagrams.
%ex_6_14_cascadeHz.m
% Reference: Example 6.14
% Fundamentals of Digital Signal Processing, 2002,
% by Joyce Van de Vegte, from Prentice Hall, ISBN 0-13-016077-6
%
% Three cascading sections of a filter:
% y1[n] = x1[n] - 0.1 x1[n-1] + 0.2 x1[n-2]
% y2[n] = x2[n] + 0.3 x2[n-1] + 0.1 x2[n-2]
% y3[n] = x3[n] - 0.4 x3[n-1]
%
% Transfer Functions
% H1(z) = 1 - 0.1z^-1 + 0.2z^-2
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 6/18
5/1/2018 Z Transform 2 of 3
% H2(z) = 1 + 0.3z^-1 + 0.1z^-2
% H3(z) = 1 - 0.4z^-1
%
% H(z) = H1(z)H2(z)H3(z)
H1_z = [ 1 -0.1 0.2];
H2_z = [ 1 0.3 0.1];
H3_z = [ 1 -0.4 0];
H_z = conv(H3_z, conv(H1_z, H2_z))
% H_z = [1.0 -0.2 0.19 -0.058 0 -0.008 0]
% H(z) = 1 -0.2z^-1 + 0.19z^-2 - 0.058z^-3 + 0.0z^-4 - 0.008z^-5
Example 6.15: Find the transfer function of the transposed direct form 2 realization of the filter.
%ex_6_15_cascadeHz.m
% Reference: Example 6.15
% Fundamentals of Digital Signal Processing, 2002,
% by Joyce Van de Vegte, from Prentice Hall, ISBN 0-13-016077-6
%
% Three cascading sections of a filter:
% y1[n] = -0.1y1[n-1] + 0.5y1[n-2] + 2.5x1[n] +0.9x1[n-1] -0.4x1[n-2]
% y2[n] = 0.2y2[n-1] -0.2y2[n-2] + 1.2x2[n-1] + 0.5x2[n-1] + 0.1x2[n-2]
%
% Transfer Functions
% H1(z) = (2.5 + 0.9z^-1 - 0.4z^-2)/(1 + 0.1 z^-1 - 0.5z^-2)
% H2(z) = (1.2 + 0.5z^-1 + 0.1z^-2)/(1 - 0.2z^-1 + 0.2z^-2)
%
% H(z) = H1(z)H2(z)
numH1_z = [ 2.5 0.9 -0.4];
denH1_z = [ 1 0.1 -0.5];
numH2_z = [ 1.2 0.5 0.1];
denH2_z = [ 1 -0.2 0.2];
numH_z = conv(numH1_z, numH2_z)
denH_z = conv(denH1_z, denH2_z)
printsys(numH_z, denH_z, 'z')
numH_z =
3.0000 2.3300 0.2200 -0.1100 -0.0400
denH_z =
1.0000 -0.1000 -0.3200 0.1200 -0.1000
num/den =
3 z^4 + 2.33 z^3 + 0.22 z^2 - 0.11 z - 0.04
-------------------------------------------
z^4 - 0.1 z^3 - 0.32 z^2 + 0.12 z - 0.1
Example 6.16
Find the transfer function for the parallel combination in Figure 6.8.
%ex_6_16_cascadeHz.m
% Reference: Example 6.16
% Fundamentals of Digital Signal Processing, 2002,
% by Joyce Van de Vegte, from Prentice Hall, ISBN 0-13-016077-6
%
% Find the y2[n] for the lower section of the filter:
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 7/18
5/1/2018 Z Transform 2 of 3
% y[n] = y1[n] + y2[n]
% = upper section output + lower section output
% y2[n] = 0.2y2[n-1] + 0.4y2[n-2] + 0.25x[n] +0.1x[n-1]
% y1[n] = x[n-1]
%
% Transfer Functions
% H2(z) = (1 + 0.25z^-1 + 0.1z^-2)/(1 + 0.2z^-1 + 0.4z^-2)
% H1(z) = z^-1
% H(z) = H1(z) + H2(z)
% === Conver all H1(z)and H2(z)to show the positive z terms
% H2(z) = (z^2 + 0.25z + 0.1)/(z^2 + 0.2z + 0.4)
% H1(z) = 1/z
% H(z) = H1(z) + H2(z)
% z^2 + 0.25z + 0.1 1
% = --------------------- + ----
% z^2 + 0.2z + 0.4 z
%
% Combining H1(z) and H2(z) with the common denominator:
%
% z(z^2 + 0.25z + 0.1) + 1(z^2 + 0.2z + 0.4)
% = --------------------------------------------
% (z^2 + 0.2z + 0.4)z
%
% z^3 + 0.25z^2 + 0.1z + z^2 + 0.2z + 0.4
% = --------------------------------------------
% (z^2 + 0.2z + 0.4)z
%
% z^3 + 1.25z^2 + 0.3z + 0.4
% = ----------------------------------
% z^3 + 0.2z^2 + 0.4z
%
% z^-3
% Multipying H(z)* ------
% z^-3
%
% 1 + 1.25z-1 + 0.3z^-2 + 0.4z^-3
% = ----------------------------------
% 1 + 0.2z^-1 + 0.4z^-2
numH2_z = [ 1 0.25 0.1];
denH2_z = [ 1 0.2 0.4];
numH1_z = [ 1 0 0 ];
denH1_z = [ 0 1 0 ];
denH2 = [ 0 0 1 0.2 0.4];
numH_z = conv(numH2_z, denH1_z) + denH2
denH_z = conv(denH1_z, denH2_z)
printsys(numH_z, denH_z, 'z')
numH_z =
0 1.0000 1.2500 0.3000 0.4000
denH_z =
0 1.0000 0.2000 0.4000 0
num/den =
z^3 + 1.25 z^2 + 0.3 z + 0.4
----------------------------
z^3 + 0.2 z^2 + 0.4 z
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 8/18
5/1/2018 Z Transform 2 of 3
Back to Time Domain
y[n], x[n], h[n] → z-Transforms => Y(z), X(z), H(z)
Y(z), X(z), H(z) → Inverse z-Transform => y[n], x[n], h[n]
z-Transform in Standard Form
All z terms are in positive terms)
The coefficient of the highest power term in both the numerator and the denominator be 1
Assuming N > M, the transfer function in (6.2)
Becomes
Where
Terms used for describing H(z)
Degree:
The highest power in a polynomial
Proper Rational Function:
The degree of the numerator is less than or equal to the degree of the denominator
Strictly Proper Rational Function:
The degree of the numerator is less than the degree of the denominator
Improper Rational Function
The degree of the numerator is greater than the degree of its denominator
Example 6.17
Express the following transfer function in standard form:
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 9/18
5/1/2018 Z Transform 2 of 3
Step 1: Make the exponents of all delay terms positive
Identifying the most negative exponent
Select to multiplying on both numerator and denominator of H(z)
Step 2: Ensure the coefficient of highest power denominator to be one
· Divide by 4 to give the standard form
Example 6.18
Convert the proper transfer function into a strictly proper expression.
Answer:
Using Long division:
Thus,
MATLAB Example
%ex_6_18_transfer.m
% Reference: Example 6.18
% Fundamentals of Digital Signal Processing, 2002,
% by Joyce Van de Vegte, from Prentice Hall, ISBN 0-13-016077-6
%
% Convert the proper transfer function
% Transfer Functions
% H(z) = (z^2 + 0.1z + 0.3)/(z^2 - 0.5z + 0.9)
numH_z = [1 0.1 0.3];
denH_z = [1 -0.5 0.9];
printsys(numH_z, denH_z, 'z')
num/den =
z^2 + 0.1 z + 0.3
-----------------
z^2 - 0.5 z + 0.9
Simple Inverse z-Transform
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 10/18
5/1/2018 Z Transform 2 of 3
Example 6.19
Find the signal x[n] that corresponds to the z-transform X(z) = .
Answer: From table 6.1
Example 6.20
Find the inverse-z transform of the function
Answer: From table 6.1, we can match X(z) to
where cosΩ = 0.9, Ω = cos-1(0.9) = 0.451
The inverse transform is
Example 6.21
A system’s transfer function is
a. Find the difference equation for this system.
b. Find the impulse response for this system.
Answer:
a.
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 11/18
5/1/2018 Z Transform 2 of 3
The difference equation is y[n] +0.25y[n-1] = x[n-2].
b. The impulse response for this system is the inverse z-transform of its transfer function H(z):
From Table 6.1,
So the impulse response h[n] with the two-step delay is
Example 6.22
The input to a digital filter is x[n] = u[n]. The output form the filter is
a. Find the transfer function of the filter.
b. Find the impulse response of the filter.
Answer:
a. From Table 6.1,
Compute H(z)
b. Convert H(z) into strictly proper form using long-division
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 12/18
5/1/2018 Z Transform 2 of 3
Z(δ[n]) ↔ 1
So
Example 6.23
Find the time domain signal x[n] that corresponds to the z-transform
So
Inverse z-Transform by Long Division
Example 6.24
Find inverse z transform of H(z) using long-division.
So H(z) =
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 13/18
5/1/2018 Z Transform 2 of 3
And the inverse z transform of H(z) is
h[n] =δ[n]-0.5δ[n-1] -0.6δ[n-2] + 0.64δ[n-3] - …
No close form is available through the long-division.
Example 6.25
Using long division, find the time domain signal x[n] that corresponds to the z transform of Example 6.23, that
is
Answer:
So we have
And
x[n] = 5δ[n-2] – δ[n-3] + 0.2δ[n-4] – 0.04δ[n-5] + …
We can identify the pattern that defines x[n], so a close form can be found
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 14/18
5/1/2018 Z Transform 2 of 3
Inverse z-Transform by Partial Fraction Expansion
· x[n] = u[n-1] – Input to the system
Z{z[n-1]} = X(z) =
· h[n] = (-0.25)n u[n] – Impulse response of the system
Z{h[n]} =
· Y(z) = H(z)X(z) =
Find A and B:
And then find the inverse z-transform y[n]
MATLAB Solution:
>> help residuez
RESIDUEZ Z-transform partial-fraction expansion.
[R,P,K] = RESIDUEZ(B,A) finds the residues, poles and direct terms
of the partial-fraction expansion of B(z)/A(z),
B(z) r(1) r(n)
---- = ------------ +... ------------ + k(1) + k(2)z^(-1) ...
A(z) 1-p(1)z^(-1) 1-p(n)z^(-1)
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 15/18
5/1/2018 Z Transform 2 of 3
B and A are the numerator and denominator polynomial coefficients,
respectively, in ascending powers of z^(-1). R and P are column
vectors containing the residues and poles, respectively. K contains
the direct terms in a row vector. The number of poles is
n = length(A)-1 = length(R) = length(P)
The direct term coefficient vector is empty if length(B) < length(A);
otherwise,
length(K) = length(B)-length(A)+1
If P(j) = ... = P(j+m-1) is a pole of multiplicity m, then the
expansion includes terms of the form
R(j) R(j+1) R(j+m-1)
-------------- + ------------------ + ... + ------------------
1 - P(j)z^(-1) (1 - P(j)z^(-1))^2 (1 - P(j)z^(-1))^m
[B,A] = RESIDUEZ(R,P,K) converts the partial-fraction expansion back
to B/A form.
%ex_page_190.m
% Reference: Page 190-191
% Fundamentals of Digital Signal Processing, 2002,
% by Joyce Van de Vegte, from Prentice Hall, ISBN 0-13-016077-6
%
% X(z) = 1/(z-1)
% H(z) = z/(z + 0.25)
% Y(z) = H(z)X(z) = z/(z + 0.25)(z-1)
numH_z = [0 1 0];
denH_z = conv([1 0.25], [1 -1]);
printsys(numH_z, denH_z, 'z')
% z
% Y(z) = ------------------
% z^2 – 0.75z -0.25
% z^-2(z)
% = -----------------------
% z^-2(z^2 – 0.75z -0.25)
%
% z^-1
% = -----------------------
% 1 – 0.75z^-1 -0.25z^-2
B = [0 1];
A = [1 -0.75 -0.25]
[r, p, k] = residuez(B, A)
% r – residues
% p - poles
num/den =
z
-------------------
z^2 - 0.75 z - 0.25
r=
0.8000
0.2000
p=
1.0000
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 16/18
5/1/2018 Z Transform 2 of 3
-0.2500
This corresponds to
And y[n] can be obtained
%ex_matlab.m
% Reference: Page 1-35
% MATLAB Signal Processing Toolbox - User's Guide
%
% H(z) = -4+8z^-1/(1 + 6z^-1 + 8z^-2)
numH_z = [-4 8];
denH_z = [1 6 8];
[r, p, k] = residuez(numH_z, denH_z)
% r – residues
% p - poles
r=
-12
8
p=
-4
-2
This corresponds to H(z)
And the impulse response h[n] is
, n = 0, 1, 2,..
Example 6.26
Find the inverse z-transform of
Using partial fraction expansion to expand the Y(z) as
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 17/18
5/1/2018 Z Transform 2 of 3
Find
Hence
Find the inverse z-transform using Table 6.1.
http://www.etcs.ipfw.edu/~lin/ECET357/2007Spring/Lectures/6_z-Transfomrs_S07_2_of_3.html 18/18