Z-Transform: 10.1 Mathematical de Finition
Z-Transform: 10.1 Mathematical de Finition
Z-Transform: 10.1 Mathematical de Finition
10
z-Transform
In other words, the z-transform of a function f [n] is a function F(z). The mathematical
expression of the two-sided (or bilateral) z-transform is
X
1
F(z) ¼ Z{ f [n]} ¼ f [n]zn , (10:2)
n¼1
where z is a complex variable. Setting the lower limit of the sum from minus infinity to zero
yields the one-sided (or unilateral) z-transform whose mathematical expression is
X
1
F(z) ¼ Z{ f [n]} ¼ f [n]zn : (10:3)
n¼0
In order to return from the z-domain back to the discrete-time domain, the inverse
z-transform is applied. The inverse z-transform is denoted by the symbol Z1{}, that is,
one can write
449
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 450 8.4.2010 4:55am Compositor Name: PG1421
þ
1
x[n] ¼ X(z)zn1 dz: (10:5)
2pj
Example
Compute the z-transform of the sequence x[n] ¼ [3,5,4,3], 0 n 3.
The z-transform of the sequence x[n] is directly computed from Equation 10.3.
Finally, if x[n] is a sequence of infinite samples, we must use the command symsum to
compute its z-transform.
Example
Compute the z-transform of the sequence x[n] ¼ 0.9n u[n].
z-Transform 451
using the command iztrans. Before using these two commands, the declaration of
the complex variable z and of the discrete time n as symbolic variables is necessary.
Recall that in order to define a symbolic variable, the command syms is used.
The commands ztrans and iztrans are used exactly in the same way as the commands
laplace and ilaplace are used to compute the Laplace and inverse Laplace trans-
forms of a function. Finally, we note that the command ztrans computes the unilateral
z-transform.
Example
Compute the (unilateral) z-transform of the sequence f [n] ¼ 2n.
Example
Compute the inverse z-transform of the function F(z) ¼ (z=(z 2)).
The functions f [n] ¼ 2nu[n] and F(z) ¼ (z=(z 2)) are a z-transform pair. In other words,
the z-transform of f [n] ¼ 2nu[n] is F(z) ¼ (z=(z 2)), while the inverse z-transform of
F(z) ¼ (z=(z 2)) is the sequence f [n] ¼ 2nu[n]. A z-transform pair is denoted as
x[n] $ X(z). In our case 2nu[n] $ (z=(z 2)). In Section 10.4, we present the most
common z-transform pairs. At the moment, we discuss alternative syntaxes of the com-
mands ztrans and iztrans. The most effective, and in the same time simple, syntax
of the command ztrans is ztrans(f,z). In this way, the z-transform of a sequence
f [n] is expressed with the second input argument (here is z) as the independent
variable. Using this syntax is optimal and makes possible the computation of the
z-transform in every case. Such a case is when the z-transform of a constant function has
to be computed.
The z-transform of a function can be expressed in terms of another variable (e.g., w).
Of course, if a symbolic variable is once declared (and not erased using the command
clear), it does not have to be declared every time is used. Regarding the inverse
z-transform, the optimal syntax of the command iztrans is iztrans(F,n). In this
way, the inverse z-transform of the signal F(z) is expressed in terms of the variable that
appears as the second input argument (here is n). Correspondingly, with the ztrans
command, there is the possibility of expressing the inverse z-transform of a function F(z)
with alternative variable (e.g., t) as independent variable.
z-Transform 453
Discrete-Time
Domain z-Domain Commands Results
x[n] d [n] X(z) 1 syms n z a w ans ¼ dirac(0) %
f ¼ dirac(n); ztrans(f,z) d (0) ¼ 1.
1. Linearity: If X1 (z) ¼ Z{x1 [n]} and X2 (z) ¼ Z{x2 [n]}, then for any scalars a1,a2,
2. Right shift of x[n]u[n]: If X(z) ¼ Z{x[n]} and x[n] is causal, i.e., x[n] ¼ 0, n < 0, then
for any positive integer m,
3. Right shift of x[n]: If X(z) ¼ Z{x[n]}, then for any positive integer m,
(continued)
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 455 8.4.2010 4:55am Compositor Name: PG1421
z-Transform 455
(continued)
4. Left shift in time: If X(z) ¼ Z{x[n]}, then for any positive integer m,
Right ¼ z^2*X-x0*z^2-x1*z; ans ¼ 16=5*z=(5*z4) The right side of (10.12) is equal to the
simplify(Right) left one, hence the left-shifting
property of z-transform
is demonstrated.
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 456 8.4.2010 4:55am Compositor Name: PG1421
and
z
Z{an x[n]} ¼ X : (10:15)
a
L ¼ a^n*x; Left ¼ ztrans The left side of (10.15) is equal to the right
ans ¼ z=(zþ4*a)
(L,z); simplify(Left) one, hence Equation 10.15 is also confirmed.
syms z
x ¼ [1 2 3 4]; The signal x[n] ¼ [1, 2, 3, 4], 0 n 3 is
n ¼ [0 1 2 3]; Right ¼ 1þ2*z
considered. The right side is computed
X ¼ sum(x.*(z.^-n)); þ3*z^2þ4*z^3
by substituting z with z1 in X(z).
Right ¼ subs(X,z,z^1)
(continued)
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 457 8.4.2010 4:55am Compositor Name: PG1421
z-Transform 457
(continued)
dX(z)
Z{n x[n]} ¼ z : (10:18)
dz
X ¼ ztrans(x,z)
d ¼ diff(X,z); The right side of (10.18) equals the left one,
ans ¼ 90*z=
Right ¼ -z*d hence the differentiation in the z-domain
(10*z9)^2
simplify(Right) property is verified.
9. Convolution in the time domain: If X1(z) ¼ Z{x1[n]} and X2(z) ¼ Z{x2[n]}, then
syms n z
x1 ¼ 0.9.^n;
3
x2 ¼ 0.8.^n; Z−1[X1(z) X2(z)]
X1 ¼ ztrans(x1,z); 2.5 Next, we compute and plot
X2 ¼ ztrans(x2,z); 2 the right side of (10.21).
Right ¼ iztrans(X1*X2); 1.5
The two graphs are alike;
n ¼ 0:100; 1
hence, the convolution
Right ¼ subs(Right,n); property of the
0.5
stem(0:100, Right) z-transform is confirmed.
0
legend('Z^-^1[X_1(z) 0 10 20 30 40 50 60 70 80 90 100
X_2(z)]');
10. Complex conjugation: If X(z) ¼ Z{x[n]} and x*[n] is the complex conjugate of x[n],
then
z-Transform 459
11. Initial value theorem: If X(z) ¼ Z{x[n]}, then the initial values of x[n] can be computed
according to the following relationships:
X ¼ ztrans(x,z);
x0 ¼ limit(X,z,inf) The initial values x[0], x[1], x[2] are computed
x1 ¼ 4
x1 ¼ limit(z*X-z*x0,z,inf) according to the relationships given in (10.23), and the
x2 ¼ 9
x2 ¼ limit( (z^2)*X- validity of (10.23) is demonstrated.
(z^2)*x0-z*x1,z,inf)
12. Final value theorem: If X(z) ¼ Z{x[n]} and the limit of x[n] when n tends to infinity
exists, then
lim x[n] ¼ lim [(z 1)X(z)] ¼ lim [(1 z1 )X(z)]: (10:24)
n!1 z!1 z!1
where ai, bi are real numbers. In order to express the function X(z) in a partial fraction
form, we follow a similar approach to that followed in the Laplace transform chapter.
Hence, the first case considered is when m < n, that is, when the degree of the numerator
polynomial B(z) is lower than the degree of the denominator polynomial A(z). Suppose
that li are the roots of A(z). The following cases are considered:
c1 c2 cn
X(z) ¼ þ þ þ , (10:26)
z l1 z l2 z ln
Example
Express in the partial fraction expansion form the signal which in the z-domain is given by
z2 þ 3z þ 1
X(z) ¼ 3 .
z þ 5z2 þ 2z 8
syms z
X ¼ (z^2þ3*zþ1)=
(z^3þ5*z^2þ2*z8);
c1 ¼ limit( (z-ro(1)) c1 ¼ 1=2
The coefficients ci are calculated
*X,z,ro(1)) c2 ¼ 1=6
according to Equation 10.27.
c2 ¼ limit( (z-ro(2)) c3 ¼ 1=3
*X,z,ro(2))
c3 ¼ limit( (z-ro(3))
*X,z,ro(3))
Hence, we obtain
2. The roots li are repeated. Suppose that the root l1 is repeated r times and all other
roots are distinct. Q In this case, A(z) is written in the factored form
A(z) ¼ an (z l1 )r ni¼rþ1 z li , while X(s) is written as
c1 c2 cr crþ1 cn
X(z) ¼ þ þ þ þ þ þ : (10:28)
z l1 (z l1 )2 (z l1 )r z lrþ1 z ln
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 461 8.4.2010 4:55am Compositor Name: PG1421
z-Transform 461
Example
Express in partial fraction expansion form the signal
z2 þ 3z þ 1
X(z) ¼ :
z3 3z þ 2
di ¼ diff(f,z,r2);
Coefficient c3 is computed in the same way
fact ¼ 1=factorial(r2); c3 ¼ 5=3
to c2, but here we set i ¼ 2.
c3 ¼ limit(fact*di,z,1)
Therefore,
z2 þ 3z þ 1 1=9 10=9 5=3
X(z) ¼ ¼ þ þ :
z 3z þ 2 z þ 2 z 1 (z 1)2
3
Example
Express in partial fraction form the signal
z2 þ 3z þ 1
X(z) ¼ :
z3 3z þ 2
Let us consider now the case where m n, i.e., the degree of the numerator polynomial B(z)
is greater than or equal to the degree of the denominator polynomial A(z). In a world
without MATLAB, we would have to implement the division between B(z) and A(z), write
the signal X(z) in the form K(z) þ (G(z)=A(z)), and then apply the relationships (10.26)
through (10.29) to expand the signal as a sum of first-order rational functions. Fortunately,
the command residue is applicable also in the case m n.
Example
Express in partial fraction form the signal
3z3 þ 8z2 þ 4
X(z) ¼ :
z2 þ 5z þ 4
The obtained result is confirmed by using the reverse syntax of the residue command.
An alternative command (especially suitable for the z-transform) that can be used to
expand a rational function into partial fraction form is the command residuez. The
syntax is [r,p,k] ¼ residuez(num,den), where num and den denote the coefficients
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 463 8.4.2010 4:55am Compositor Name: PG1421
z-Transform 463
r1 r2 rn
X(z) ¼ þ þ þ þ K(z), (10:31)
1 p1 z1 1 p2 z1 1 pn z1
r1 r2 rq rqþ1
X(z) ¼ 1
þ þ þ 1 qþ þ
1 p1 z 1
(1 p1 z ) 2 (1 p1 z ) 1 pqþ1 z1
rn
þ þ K(z): (10:32)
1 pn z1
The inverse syntax of the residuez command, i.e., [num,den] ¼ residuez(r,p,k) does the
inverse operation, that is, expresses a function from partial fraction form to rational form.
Example
Express in partial fraction form the signal
X
q X
p
y[n] ¼ bk x[n k] þ ak y[n k], (10:34)
k¼0 k¼1
where bk and ak are constant numbers. Recall that the solution of a difference equation is a
sequence y[n] that satisfies the difference equation for any n. The computational process
followed is similar to the one followed when solving differential equations by use of the
Laplace transform. Hence, the steps followed are
Example
Find the solution of the difference equation y[n] þ 0:5y[n 1] þ 2y[n 2] ¼ 0:9n u[n],
where y[n] ¼ 0, n < 0.
z-Transform 465
3. The z-transforms of y[n], y[n 1], and y[n 2] are substituted according to Equa-
tions 10.35 through 10.37, and the difference equation is converted to the algebraic
equation
z
Y(z) ¼ 0:5z1 Y(z) þ 2z2 Y(z) ¼ :
z 0:9
4. We solve the equation for Y(z) and get
z z3
Y(z) ¼ ¼ :
(z 0:9)(1 þ 0:5z1 þ 2z2 ) (z 0:9)(z2 þ 0:5z þ 2)
(continued)
−20
0 1 2 3 4 5 6 7 8 9 10
In order to confirm that y[n] is in fact the solution of the difference equation, y[n] is inserted
in the difference equation. If it satisfies the difference equation, then it is indeed its solution.
Solution
Problem 2
z-Transform 467
Solution
a. syms n z X ¼ z*(zþ1)=(z1)^3
x ¼ n^2*heaviside(n);
X ¼ ztrans(x,z)
b. iztrans(X,n) ans ¼ n^2
Problem 3
Solution
a. syms n z X ¼ z=(z1)
x ¼ cos(2*pi*n);
X ¼ ztrans(x,z)
b. iztrans(X,n) ans ¼ 1
With a first glance, the result is not confirmed by the inverse z-transform operation.
However, considering that n takes only integer values yields cos(2pn) ¼ 1, 8n2Z, and the
result is confirmed.
2z þ 3
Problem 4 Find the inverse z-transform of X(z) ¼
z2 þ 5z þ 6
a. When X(z) is in rational form
b. When X(z) is in partial fraction form
Solution
The derived result is same in both cases. However, an unknown function charfcn appears
in our results. To learn more about this function we type mhelp charfcn, and the help text
displayed in the command window states that charfcn[A](x) is 1 if x belongs to set A and
0 if not. In our case, the statement charfcn[0](n) is 1 for n ¼ 0 and 0 elsewhere.
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 468 8.4.2010 4:55am Compositor Name: PG1421
Solution
First, the signal f [n] is defined as a single symbolic expression. The three-part function f [n]
is written as
n1 ¼ 0:3;
f1 ¼ 0.9.^n1;
n2 ¼ 4:6; 1
f2 ¼ 2.^(-n2);
0.8
n3 ¼ 7:10; Graph of f [n] using
f3 ¼ ones 0.6 the technique of
(size(n3)); plotting multipart
0.4
n ¼ [n1 n2 n3]; functions.
f ¼ [f1 f2 f3]; 0.2
stem(n,f); 0
axis([-.5 10.5 - 0 1 2 3 4 5 6 7 8 9 10
.1 1.1]);
syms n z
n1 ¼ 4;
n2 ¼ 7; Graph of f [n]
n3 ¼ 11; according to its
f1 ¼ 0.9^n; symbolic expression.
1
f2 ¼ 2^(n); The graphs are alike
f3 ¼ 1; 0.8 except from the
f ¼ f1* 0.6 points n ¼ 0,4,7
(heaviside where f [n] has no
0.4
(n)-heaviside value. This is due to
(nn1)) þf2* 0.2 the way the
(heaviside 0 command heaviside
(nn1)- 0 1 2 3 4 5 6 7 8 9 10 is defined in
heaviside MATLAB. However,
(nn2)) þf3* this fact does not
(heaviside affect the z-transform
(nn2)- computation.
heaviside
(nn3));
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 469 8.4.2010 4:55am Compositor Name: PG1421
z-Transform 469
(continued)
n_s ¼ 0:10;
f_s ¼ subs
(f,n_s);
stem(n_s,f_s);
axis([-.5 10.5
-.1 1.1]);
The signal is defined as a
F1 ¼ 1þ9=10=zþ81=100=z^2þ729=1000=
a. F1 ¼ ztrans three-part function and its
z^3þ1=16=z^4 þ1=32=z^5þ1=64=z^
(f,z) z-transform is computed
6þ1=z^7þ1=z^8þ1=z^9þ1=z^10
according to its definition.
b. n1 ¼ 0:3;
f1 ¼ 0.9.^n1;
n2 ¼ 4:6;
f2 ¼ 2.^(-n2);
n3 ¼ 7:10; F2 ¼ 1þ9=10=zþ81=100=z^2þ729=1000=
The two derived results
f3 ¼ ones z^3þ1=16=z^4þ1=32=z^5þ1=64=z^6þ
are the same.
(size(n3)); 1=z^7þ1=z^8þ1=z^9þ1=z^10
n ¼ [n1 n2 n3];
f ¼ [f1 f2 f3];
F2 ¼ sum
(f.*(z.^-n))
ftest ¼ charfcn[0](n)þ9=10*charfcn[1](n)þ
c. syms n 81=100*charfcn[2](n)þ729=1000*
ftest ¼ charfcn[3](n)þ1=16*charfcn[4](n)þ
iztrans 1=32*charfcn[5](n)þ1=64*charfcn[6](n)þ
(F1,n) charfcn[7](n)þcharfcn[8](n)þ
charfcn[9](n)þcharfcn[10](n)
n ¼ 0:10;
1
ftest1 ¼ subs
(ftest,n); 0.8
stem(n,ftest1); 0.6
axis([.5 10.5
0.4
.1 1.1]);
0.2
0
0 1 2 3 4 5 6 7 8 9 10
Variable ftest is the inverse z-transform of the computed function F(z). Hence, we expect
that ftest is equal to the original signal f [n]. Indeed, the graph of ftest is identical to that of
f [n]; hence, the computation of the z-transform F(z) of f [n] is correct.
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 470 8.4.2010 4:55am Compositor Name: PG1421
Problem 6
Solution
a. syms n z Y
x ¼ heaviside(n);
X ¼ ztrans(x,z);
Y1 ¼ z^(1)*Y;
The solution y[n] is y ¼ 1þn
G ¼ Y-Y1X;
SOL ¼ solve(G,Y);
y ¼ iztrans
(SOL,n)
b. n1 ¼ 0:50; 60
Solution y[n]
yn ¼ subs 50
(y,n,n1);
40
stem(n1,yn);
legend 30
('Solution 20
y[n]');
10
0
0 5 10 15 20 25 30 35 40 45 50
c. yntest ¼ y;
yn_1test ¼ subs
The result is zero
(y,n,n-1); test ¼ 1-heaviside(n)
test ¼ yntest-yn_ for n 0.
1test-x
Problem 7
a. Use z-transform to find the solution of the difference equation y[n] y[n 1] ¼
x[n] þ x[n 1], where x[n] ¼ 0.8n u[n].
b. Plot the solution for 0 n 20.
c. Confirm your result by inserting the obtained solution in the difference
equation.
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 471 8.4.2010 4:55am Compositor Name: PG1421
z-Transform 471
Solution
a. syms n z Y
x ¼ 0.8^n;
X ¼ ztrans(x,z);
Notice
X1 ¼ z^(1)*X;
how the z-transform
Y1 ¼ z^(1)*Y;
The solution y[n] is y ¼ 10-9*(4=5)^n of x[n 1]
G ¼ YY1XX1;
(denoted by X1)
SOL ¼ solve
is defined.
(G,Y);
y ¼ iztrans
(SOL,n)
b. n_s ¼ 0:30; 10
Solution y[n]
y_s ¼ subs 8
(y,n,n_s);
stem(n_s,y_s); 6
legend
4
('Solution
y[n]'); 2
0
0 5 10 15 20 25 30
c. xn ¼ 0.8^(n);
xn_1 ¼ .8^
(n1); Inserting the
yn ¼ 10-9* obtained solution in
(4=5)^n; the difference equation
yn_1 ¼ 10-9* ans ¼ 0 yields zero, thus y[n]
(4=5)^(n1); is indeed the solution
test ¼ yn-yn_1 of the difference
xnxn_1; equation.
simplify(test)
Solution
syms n z Y
x ¼ 0.8^n;
X ¼ ztrans (x,z);
X1 ¼ z^(1)*X;
Y1 ¼ z^(1)*Y; The solution y[n] is
Y2 ¼ z^(2)*Y; y ¼ 5=13*(1=2)^n
G ¼ Yþ1.5*Y1þ þ8=13*(4=5)^n
0.5*Y2XX1;
SOL ¼ solve (G,Y);
y ¼ iztrans (SOL,n)
(continued)
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 472 8.4.2010 4:55am Compositor Name: PG1421
(continued)
a. n_s ¼ 0:20;
1 Solution y[n]
y_s ¼ subs
(y,n,n_s); 0.8
stem(n_s,y_s);
0.6
legend
('Solution 0.4
y[n]') 0.2
xlim([.5 20.5])
ylim([0 1.1]) 0
0 2 4 6 8 10 12 14 16 18 20
b. xn ¼ x;
xn_1 ¼
0.8^(n1);
yn ¼ y;
Inserting the obtained
yn_1 ¼ subs
solution in the
(y,n,n1);
difference equation
yn_2 ¼ subs
ans ¼ 0 yields zero, thus
(y,n,n2);
y[n] is indeed the
test ¼ ynþ
solution of the
1.5*yn_1þ
difference equation.
0.5*yn_
2-xn-xn_1
simplify
(test)
Solution
In this difference equation, we have nonzero initial conditions for y[n]. Thus, the
z-transform of y[n 1] and y[n 2] are computed according to the property given in
(10.8) and (10.9). Therefore, the z-transforms of y[n], y[n 1], y[n 2], x[n], and x[n 1]
are given by
Z{y[n]} ¼ Y(z)
Z{y[n 1]} ¼ z1 Y(z) þ y[ 1]
Z{y[n 2]} ¼ z2 Y(z) þ y[ 2] þ z1 y[ 1]
Z{x[n]} ¼ X(z)
Z{x[n 1]} ¼ z1 X(z)
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 473 8.4.2010 4:55am Compositor Name: PG1421
z-Transform 473
0
0 5 10 15 20 25 30 35 40 45 50
a. xn ¼ 0.9^(n);
xn_1 ¼ .9^
(n-1);
yn ¼ 9=8*
(1=2)^nþ
9=8*(9=10)^n;
yn_1 ¼ 9=
8*(1=2)^
(n-1)þ9=8*
The obtained sequence
(9=10)^(n-1);
ans ¼ 0 y[n] satisfies the
yn_2 ¼ 9=8*
difference equation
(1=2)^(n-2)þ
9=8*(9=10)^
(n-2);
test ¼ 2*yn-
3*yn_1þ
yn_2-xnþ
xn_1;
simplify
(test)
b. a ¼ [2 -3 1];
b ¼ [1 -1];
yit ¼ [1 2]; 0.7
y[n] from filter
zi ¼ filtic 0.6 The solution is derived
(b,a,yit) with use of the
0.5
n ¼ 0:50; command filter.
x ¼ 0.9.^n; 0.4
Notice how the initial
y ¼ filter 0.3 conditions are defined
(b,a,x,zi); 0.2 with the command
stem(n,y); filtic.
0.1
title('y[n]
from 0
0 5 10 15 20 25 30 35 40 45 50
filter');
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 474 8.4.2010 4:55am Compositor Name: PG1421
2z2 þ z 1
X(z) ¼ :
z3 3z þ 2
z3 3z þ 2
X(z) ¼ :
2z2 þ z 1
z-Transform 475
12 46z1 þ 34
X(z) ¼ :
1 þ 7z1 þ 16z2 12z3
17. Compute and plot the solution of the difference equation y[n] 3y[n 1] þ y
[n 2] ¼ x[n] x[n 1], where x[n] ¼ 0.8n u[n] assuming zero initial conditions.
Moreover, verify your answer (a) by examining if the derived solution satisfies
the difference equation and (b) by computing the solution with use of the com-
mand filter.
18. Compute and plot the solution of the difference equation 2y[n] 0.5y[n 2] ¼
2x [n] x[n 2], where x[n] ¼ 0.9n u[n] and the initial conditions are y[1] ¼ 3
and y[2] ¼ 2.
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 476 8.4.2010 4:55am Compositor Name: PG1421