Z- Transform
Z- Transform
Objective:
The objectives of this application are to:
1. Converts the linear ordinary difference equations into algebraic
equations in the z- transform.
2. Obtain the discrete time function from the function in the z- domain.
Introduction:
The z-transform is a mathematical tool commonly used for the analysis
of discrete time control systems. The role of the z- transform in discrete
time systems is similar to that of the Laplace transform in continuous
time systems. In a linear discrete time control system, a linear difference
equation characterizes the dynamics of the system. To determine the
system’s response to a given input, such a difference equation must be
solved. With the z-transform method, the solution to linear difference
equations become algebraic in nature.
The z-transform method is an operational method that is very powerful
when working with discrete time systems, the z-transform is defined by:
∞
Example 1.1: Use MATLAB to find the right side z-transform of the
following elementary functions:
Solution:
% 1. To determine the z- transform for unit step function %
syms a k T
x=T^0
X=ztrans(x)
pretty(X)
z
-------
z–1
% 2. To determine the z- transform for unit ramp function %
x=k*T;
X=ztrans(x);
pretty(X)
Tz
----------
(z - 1)2
% 3. To determine the z- transform for exponential function %
x=exp(-k*T);
X=ztrans(x);
pretty(X)
z
--------------
z - exp(-T)
% 4. To determine the z- transform for sine function %
x=sin(a*k*T);
X=ztrans(x);
pretty(X)
z sin(aT)
-------------------------
z2 - 2 z cos(aT) + 1
Example 1.2: Use MATLAB to find the right side z-transform of the
following functions:
1. 𝑥(𝑡) = 3𝑢(𝑡) + 2 𝑡𝑢(𝑡)
2. 𝑥(𝑡) = 2 cos(3𝑡) + 𝑒 −2𝑡 sin(2𝑡)
3. 𝑥[𝑘] = 9𝑘(2𝑘−1 ) − 2𝑘 + 3
Solution:
% 1. To determine the z-transform of 𝒙(𝒕) = 𝟑𝒖(𝒕) + 𝟐 𝒕𝒖(𝒕)%
syms k T
x=3+2*k*T;
X=ztrans(x);
pretty(X)
3z 2Tz
-------- + ------------
z-1 (z - 1)2
% 2. To determine the z-transform of 𝟐 𝐜𝐨𝐬(𝟑𝒕) + 𝒆−𝟐𝒕 𝐬𝐢𝐧(𝟐𝒕)%
syms k T
x=2*cos(3*k*T)+exp(-2*k*T)*sin(2*k*T);
X=ztrans(x);
pretty(X)
2 z (z - cos(3 T)) z exp(2 T) sin(2 T)
--------------------------- + ----------------------------------------------------
z2 - 2 cos(3 T) z + 1 exp(4 T) z2 - 2 z exp(2 T) cos(2 T) + 1
Inverse z- Transform:
After transforming equations into the z- domain and solving for output
variables as functions of (z), we sometimes want transform back into the
discrete time domain. This equation is called inversion of z- transforms.
The inverse z- transformation is usually obtained by using partial fraction
expansion - or long division -. The function to be inverted 𝑋(𝑧) is merely
rearranged into a series of simple function:
𝑥[𝑘] = ʓ−1 [𝑋1 (𝑧)] + ʓ−1 [𝑋2 (𝑧)] + ⋯ + ʓ−1 [𝑋𝑁 (𝑧)]
Solution:
% 1. To perform the partial fraction expansion for: X(z)=z/((z-0.2)(z-0.5))%
a=[1];
b=conv([1 -0.2],[1 -0.5]);
[r,p,k]=residue(a,b)
r=
3.3333
-3.3333
p=
0.5000
0.2000
k=
[]
% To find the inverse z- transform …%
syms k z
X=3.3*z/(z-0.5)-3.3*z/(z-0.2);
x=iztrans(X,k)
x = 3.3*(1/2)^k – 3.3*(1/5)^k
% 2. To perform the partial fraction expansion for: X(z)=0.1z(z+1)/((z-1)2(z-0.6))%
a=[0.1 0.1];
b=conv([1 -1],conv([1 -1],[1 -0.6]));
[r,p,k]=residue(a,b)
r=
-1.0000
0.5000
1.0000
p=
1.0000
1.0000
0.6000
k=
[]
Example 1.4: Use MATLAB to determine the inverse z – transform for the
following transfer function when the input is the Kronecker delta:
1. In a close form.
2. In a sequence until 𝑥(4).
10𝑧 + 5 10𝑧 −1 + 5𝑧 −2
𝑋(𝑧) = =
(𝑧 − 1)(𝑧 − 0.2) 1 − 1.2𝑧 −1 + 0.2𝑧 −2
Solution:
% % To find the inverse z- transform for: X(z)=(10z+5)/((z-1)(z-0.2))%
% 1. In a close form %
syms k z
X=(10*z+5)/((z-1)*(z-0.2));
x=iztrans(X,k)
x=
25*kroneckerDelta(k, 0) - 43.75*(1/5)^k + 18.75
% 2. In a sequence until x(4) %
a=[0 10 5];
b=[1 -1.2 0.2];
r=[1 zeros(1,4)]
x=filter(a,b,r)
x=
0 10.0000 17.0000 18.4000 18.6800
1 for 𝑘 ≥ 0
𝑢[𝑘] = {
0 for 𝑘 < 0
Solution:
% 1. To determine the z- transform to solve the DE...%
% 𝐱(𝐤 + 𝟐) + 𝟑𝐱(𝐤 + 𝟏) + 𝟐𝐱(𝐤) = 𝟎 , 𝐱(𝟎) = 𝟎, 𝐱(𝟏) = 𝟏%
xk = sym('x(k)');
xk1 = sym('x(k+1)');
xk2 = sym('x(k+2)');
syms k z
eq = xk2 +3*xk1 +2*xk;
Zeq = ztrans(eq, k, z)
syms Xz
Zeq = subs(Zeq,{'ztrans(x(k), k, z)', 'x(0)', 'x(1)'}, {Xz, 0, 1})
eq = collect(Zeq, Xz)
X = solve(eq, Xz)
pretty(X)
z
----------------
z2 + 3 z + 2
x=iztrans(X,k)
x= (-1)^k - (-2)^k
2 𝑘 1 𝑘
2. 𝑥[𝑘] = (𝑘 (− ) ) 𝑢[𝑘] ∗ ( ) 𝑢[𝑘]
3 4
Homework 1.4: Use MATLAB to determine the inverse z- transform for the
following transfer functions are specified by its Laplace transform:
3
𝟏. 𝐹(𝑠) =
(𝑠 + 1)(𝑠 + 5)2
(𝑠 + 2)
𝟐. 𝐹(𝑠) =
(𝑠 2 + 4)(𝑠 + 8)
---------------------------------------------------------------------------------------------
Homework 1.5: A system is described by the following difference equation:
𝑦[𝑘] − 1.143𝑦[𝑘 − 1] + 0.4128𝑦[𝑘 − 2] = 0.0675𝑥[𝑘]
+ 0.1349𝑥[𝑘 − 1] + 0.675𝑥[𝑘 − 2]
Do the following
1. Write a MATLAB program that will calculate the output 𝑦[𝑘]. Run this
program solving for 𝑦[0], 𝑦[1], … . , 𝑦[30] when the initial conditions
are zero, then obtain the response of the system output to a unit step
input.
2. Repeat part (1) when the input is zero and the initial conditions are
𝑦[−1] = 1 and 𝑦[−2] = 2 using the filter and filtic commands.