You are on page 1of 28

Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 449 8.4.

8.4.2010 4:55am Compositor Name: PG1421

10
z-Transform

In this chapter, we introduce the z-transform. z-Transform is the counterpart of Laplace


transform when dealing with discrete-time signals. It is employed to transform difference
equations that describe the input=output relationships of discrete-time systems into alge-
braic equations and is a very useful tool for the analysis and design of discrete-time
systems.

10.1 Mathematical Definition


As Laplace transform is a more general transform compared to the Fourier transform for
continuous-time signals, z-transform is a more general transform than discrete-time Four-
ier transform when dealing with discrete-time signals. A discrete-time signal is defined in
the discrete-time domain n, that is, it is given by a function f [n], n 2 Z. z-Transform is
denoted by the symbol Z{} and expresses a signal in the z-domain, i.e., the signal is given
by a function F(z). The mathematical expression is

F(z) ¼ Z{ f [n]}: (10:1)

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

f [n] ¼ Z1 {F(z)}: (10:4)

The mathematical expression of the inverse z-transform is

449
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 450 8.4.2010 4:55am Compositor Name: PG1421

450 Signals and Systems Laboratory with MATLAB1

þ
1
x[n] ¼ X(z)zn1 dz: (10:5)
2pj

The z-transform of a sequence is easily computed by Equations 10.2 or 10.3.

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.

Commands Results Comments


syms z 5 4 3 z-Transform of the sequence x[n].
3þ þ 2þ 3
x0 ¼ 3; z z z
x1 ¼ 5;
x2 ¼ 4;
x3 ¼ 3;
Xz ¼ x0*(z^0)þx1*
(z^1)þx2*(z^2)þx3*(z^3) pretty(Xz)

An alternative and more elegant computation of the z-transform of x[n] is

Commands Results Comments


syms z 5 4 3 Alternative way of computing the z-transform
3þ þ 2þ 3
x ¼ [3 5 4 3]; z z z of the sequence x[n].
n ¼ [0 1 2 3];
X ¼ sum(x.*(z.^n))
pretty(X)

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].

Commands Results Comments


syms n z X ¼ 10*z=(10*z9) The z-transform of the sequence
x ¼ 0.9^n; x[n] ¼ 0.9n u[n] is X(z) ¼
z
.
X ¼ symsum z  0:9
(x.*(z.^n),n,0,inf)

10.2 Commands ztrans and iztrans


In MATLAB1, the z-transform F(z) of a sequence f [n] is computed easily by using the
command ztrans. Moreover, the inverse z-transform of a function F(z) is computed by
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 451 8.4.2010 4:55am Compositor Name: PG1421

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.

Commands Results Comments


syms n z
f ¼ 2^n; ztrans(f) ans ¼ z=(z2) The z-transform of the sequence f [n] ¼ 2n.
simplify(ans)

Example
Compute the inverse z-transform of the function F(z) ¼ (z=(z  2)).

Commands Results Comments


syms n z
z
F ¼ z=(z2); ans ¼ 2^n Inverse z-transform of the function F(z) ¼ .
z2
iztrans(F)

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.

Commands Results Comments


syms n z ??? Function ‘ztrans’ When the simple syntax of the command
f ¼ 1; is not defined for values ztrans is used, MATLAB cannot compute
ztrans(f) of class ‘double’. the z-transform of the constant sequence f [n] ¼ 1.
Using the optimal syntax of ztrans the z-transform
ztrans(f,z) ans ¼ z=(z1) of f [n] ¼ 1 is computed. The result is
F(z) ¼ Z{1} ¼ z=(z  1).
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 452 8.4.2010 4:55am Compositor Name: PG1421

452 Signals and Systems Laboratory with MATLAB1

The z-transform of a function can be expressed in terms of another variable (e.g., w).

Commands Results Comments


syms w The z-transform of f [n] ¼ n2 expressed with
f ¼ n^2 ans ¼ w*(wþ1)=(w1)^3 symbol w as the independent variable.
ztrans(f,w)
By default the z-transform is expressed with z as the
ztrans(f) ans ¼ z*(zþ1)=(z1)^3 independent variable.

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.

Commands Results Comments


syms n z t
The inverse z-transform of the signal F(z) ¼ z=(z  3) expressed
F ¼ z=(z3); f ¼ 3^t
with t as independent variable.
f ¼ iztrans(F,t)

Finally, an alternative available syntax for the z-transform computation is ztrans(f,n,z),


that is, the function f is transferred from n to z, while the inverse z-transform is computed
by using the command iztrans(F,z,n), that is, the function F is transferred from z to n.

10.3 Region of Convergence


The z-transform of a sequence does not always exist. The region of convergence (ROC) of
the z-transform of a sequence x[n] is the range of z for which the z-transform of x[n] is not
infinite.P P1z-transform
For example, the X(z) of the sequence x[n] ¼ 0.8nu[n] is computed as
1 n n n
X(z) ¼ n¼0 0:8 z ¼ n¼0 (0:8=z) . Thus X(z) converges, that is, X(z) < 1 if j0.8=zj < 1 )
jzj > 0.8. Therefore, the ROC of the z-transform X(z) of the signal x[n] ¼ 0.8nu[n] is jzj > 0.8.

10.4 z-Transform Pairs


In this section, the most common z-transform pairs are presented. In the general case, the
z-transform or the inverse z-transform of a function cannot be easily computed directly
from Equations 10.2, 10.3, and 10.5. This is the reason that already computed z-transform
pairs are used to compute the z-transform or the inverse z-transform of a complicated
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 453 8.4.2010 4:55am Compositor Name: PG1421

z-Transform 453

function. Thus, the computational procedure is to express a complicated function of


interest in terms of functions in which their z (or inverse z) transform is known. In the
table below, the most common z-transform pairs are given. The illustrated pairs are
confirmed by using the commands ztrans and iztrans. It should be noted that since
the command ztrans computes the one-sided z-transform (n  0), the unit step sequence
u[n] can be omitted from the signal definition.

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.

u[n] z=(z  1) f ¼ heaviside(n) ans ¼ z=(z1)


ztrans(f,z)

n  u[n] z=(z  1)2 ztrans(n,z) ans ¼ z=(z1)^2


anu[n] z=(z  a) F ¼ z=(za); f ¼ a^n
f ¼ iztrans(F,n)
az
n anu[n] f ¼ n*a^n; ans ¼ z*a=
(z  a)2 ztrans(f,z) (zþa)^2
z2  z cos (v0 )
cos(v0n)u[n] f ¼ cos(w*n) ans ¼ (zcos(w))
z2  2z cos (v0 ) þ 1
ztrans(f,z) *z=(z^22*z*
cos(w)þ1)
z sin (v0 )
sin(v0n)u[n] f ¼ sin(w*n); ans ¼ z*sin(w)=
z2  2z cos (v0 ) þ 1
ztrans(f,z) (z^22*z*
cos(w)þ1)
z2  az cos (v0 )
ancos(v0n)u[n] f ¼ (a^n)*cos(w*n) ans ¼ (zþ
z2  2az cos (v0 ) þ a2
ztrans(f,z) simplify(ans) cos(w)*a)*z =
(z^22*z*
cos(w)*aþa^2)
az sin (v0 )
ansin(v0n)u[n] f ¼ (a^n)*sin(w*n); ans ¼ z*sin(w)*
z2  2az cos (v0 ) þ a2
ztrans(f,z) simplify(ans) a=(z^22*z*
cos(w) *aþa^2)

10.5 Properties of z-Transform Properties


In this section, the main properties of the z-transform are introduced and verified through
appropriate examples.

1. Linearity: If X1 (z) ¼ Z{x1 [n]} and X2 (z) ¼ Z{x2 [n]}, then for any scalars a1,a2,

Z{a1 x1 [n] þ a2 x2 [n]} ¼ a1 X1 (z) þ a2 X2 (z): (10:6)


Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 454 8.4.2010 4:55am Compositor Name: PG1421

454 Signals and Systems Laboratory with MATLAB1

Commands Results Comments


syms n z Left ¼ 3*z*(zþ1)= To verify Equation 10.6, we consider
x1 ¼ n^2; (z1)^3þ2*z=(1=2*z1) a1 ¼ 3, a2 ¼ 4, and the sequences
x2 ¼ 2^n; x1[n] ¼ n2u[n], x2[n] ¼ 2nu[n]. The left side is
a1 ¼ 3; computed first.
a2 ¼ 4;
Le ¼ a1*x1þa2*x2;
Left ¼ ztrans(Le,z)

X1 ¼ ztrans(x1); Right ¼ 3*z*(zþ1)= Computation of the right side of (10.6).


X2 ¼ ztrans(x2); (z1)^3þ2*z=(1=2*z1) The two sides are equal; hence, the
Right ¼ a1*X1þa2*X2 linearity property of z-transform
is verified.

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,

Z{x[n  m]u[n  m]} ¼ zm X(z): (10:7)

Commands Results Comments


m ¼2 Left ¼ 1=z=(z3) The right-shifting property is validated
x ¼ 3^(n-m)* using the discrete-time signal x[n] ¼ 3nu[n]
heaviside(n-m); and the scalar m ¼ 2. First, we compute the
Left ¼ ztrans(x,z) left side of (10.7).
Left ¼ simplify(Left)

x ¼ 3^n*heaviside(n); Right ¼ 1=z=(z3) The right side of (10.7) is computed and is


X ¼ ztrans(x,z); equal to the left one; hence, the right-shifting
Right ¼ (z^(m))*X property is confirmed.
Right ¼ simplify(Right)

3. Right shift of x[n]: If X(z) ¼ Z{x[n]}, then for any positive integer m,

Z{x[n  1]} ¼ z1 X(z) þ x[  1] (10:8)


Z{x[n  2]} ¼ z2 X(z) þ x[  2] þ z1 x[  1] (10:9)
..
.
Z{x[n  m]} ¼ zm X(z) þ x[  m] þ z1 x[  m þ 1] þ    þ zmþ1 x[  1]: (10:10)

Commands Results Comments


n ¼ 3:3; xminus3 ¼ 1.9531 To confirm the right-shifting
x ¼ 0.8.^n; xminus2 ¼ 1.5625 property, the signal x[n] ¼ 0.8n,
xminus3 ¼ x(1) xminus1 ¼ 1.2500 3  n  3 is first defined in
xminus2 ¼ x(2) order to calculate the values x
xminus1 ¼ x(3) [1], x[2], and x[3].

(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)

Commands Results Comments


syms n z
First, we verify. (10.8). The result that
xn1 ¼ 0.8^(n1);
ans ¼ 25=4*z=(5*z4) appears in the middle tab is the left
Left ¼ ztrans(xn1,z);
side of (10.8).
simplify(Left)
x ¼ 0.8^n;
The right side of (10.8) is computed,
X ¼ ztrans(x,z);
ans ¼ 25=4*z=(5*z4) and since it is equal to the left one,
Right ¼ z^1*X þxminus1;
(10.8) is verified.
simplify(Right)
xn2 ¼ 0.8^(n2);
ans ¼ 125=16*z=
Left ¼ ztrans(xn2,z); The left side of (10.9).
(5*z4)
simplify(Left)
Right ¼ z^2*Xþxminus The right side of (10.9) is equal to the
ans ¼ 125=16*z=
2þz^1 *xminus1; left one; hence, the right-shifting
(5*z4)
simplify(Right) property of z-transform is demonstrated.

4. Left shift in time: If X(z) ¼ Z{x[n]}, then for any positive integer m,

Z{x[n þ 1]} ¼ zX(z)  x[0]z (10:11)


Z{x[n þ 2]} ¼ z2 X(z)  x[0]z2  x[1]z (10:12)
..
.
Z{x[n þ m]} ¼ zm X(z)  x[0]zm  x[1]zm1      x[m  1]z: (10:13)

Commands Results Comments


^
x0 ¼ 0.8 0 x0 ¼ 1 To confirm the left-shifting property the
x1 ¼ 0.8^1 x1 ¼ 0.8000 signal x[n] ¼ 0.8nu[n] is again
considered. First, x[0] and x[1] are
evaluated.
syms n z; ans ¼ 4*z=(5*z4) Initially, we verify Equation 10.11. The
xn1 ¼ 0.8^(nþ1); result that appears at the middle tab is
Left ¼ ztrans(xn1,z); the left side of (10.11).
simplify(Left)
x ¼ 0.8^n; ans ¼ 4*z=(5*z4) The right side of (10.11) is computed
X ¼ ztrans(x,z); and it is equal to the left one; hence,
Right ¼ z*X - x0*z; (10.11) is verified.
simplify(Right)
xn2 ¼ 0.8^(nþ2); ans ¼ 16=5*z=(5*z4) The left side of (10.12).
Left ¼ ztrans(xn2,z);
simplify(Left)

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

456 Signals and Systems Laboratory with MATLAB1

5. Scaling in the z-domain: If X(z) ¼ Z {x[n]}, then for any scalar a,

Z{an x[n]} ¼ X(az) (10:14)

and
 z
Z{an x[n]} ¼ X : (10:15)
a

An important special case is when a ¼ ejv0, for which (10.15) becomes

Z{ejv0 x[n]} ¼ X(ejv0 z):


n
(10:16)

Commands Results Comments


syms n z Equations 10.14 and 10.15 are
x ¼ 4^n; verified by using the signal
X ¼ z=(z4)
X ¼ ztrans(x,z); x[n] ¼ 4n u[n].
X ¼ simplify(X)

syms a Right ¼ In order to derive the right side of


Right ¼ a*z=(a*z4)
subs(X,z,a*z) (10.14), z in X(z) is substituted by a  z.

L ¼ a^(-n)*x; The left side of (10.14) is equal to the right


Left ¼ ztrans(L,z); ans ¼ a*z=(a*z4) one, hence Equation 10.14
simplify(Left) is confirmed.

Right ¼ subs(X,z,z=a); In order to compute the right side of


ans ¼ z=(zþ4*a)
simplify(Right) (10.15), z in X(z) is substituted by z=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 w0 Right ¼ subs Right ¼ exp(i*w0)*


The right side of (10.16).
(X,z,exp(-j*w0)*z) z=(exp(i*w0)*z4)

L ¼ exp(j*w0*n)*x; The left side is computed, and since


Left ¼ ztrans(L,z); ans ¼ 0 the difference of the two sides is
simplify(Left- Right) zero (10.16) is confirmed.

6. Time reversal: If X(z) ¼ Z{x[n]}, then

Z{x[  n]} ¼ X(z1 ): (10:17)

Commands Results Comments

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)

Commands Results Comments


To compute the left side of (10.17),
nrev ¼ [3,2,1,0]; first the time n and the signal x[n] are
xrev ¼ [4,3,2,1]; Left ¼ 1þ2*z defined. The z-transform of x[n], which
Left ¼ sum þ3*z^2þ4*z^3 is the left side of (10.17) is equal to the
(xrev.*(z.^-nrev)) right side, thus the time-reversal property
is confirmed.

7. Differentiation in the z-domain: If X(z) ¼ Z{x[n]}, then

dX(z)
Z{n  x[n]} ¼ z : (10:18)
dz

Commands Results Comments


syms n z Equation 10.18 is confirmed by using the
Left ¼ 90*z=
x ¼ 0.9^n; discrete-time signal x[n] ¼ 0.9n u[n]. First,
(10*z9)^2
Left ¼ ztrans(n*x,z) we compute the left side.

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.

8. Summation: If X(z) ¼ Z{x[n]} and x[n] is a causal discrete-time signal, then


( )
X
n
z
Z x[i] ¼ X(z): (10:19)
i¼0
z1

Commands Results Comments


syms n z The signal x[n] ¼ n2 u[n] is considered. First,
x ¼ n^2; ^ we compute
P the left side of (10.19). The
Left ¼ z 2*(zþ1)=
s ¼ symsum(x,n,0,n); sum ni¼0 x[i] is computed using the
(z1)^4
Left ¼ ztrans(s,z); command symsum.
Left ¼ simplify(Left)

The right side of (10.19) is equal to the


X ¼ ztrans(x,z); Right ¼ z^2*(zþ1)= left one, hence the summation property
Right ¼ (z=(z1))*X (z1)^4 is validated.

9. Convolution in the time domain: If X1(z) ¼ Z{x1[n]} and X2(z) ¼ Z{x2[n]}, then

Z{x1 [n]*x2 [n]} ¼ X1 (z)X2 (z): (10:20)


Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 458 8.4.2010 4:55am Compositor Name: PG1421

458 Signals and Systems Laboratory with MATLAB1

Applying inverse z-transform to both sides of (10.20) yields

x1 [n]*x2 [n] ¼ Z1 {X1 (z)X2 (z)}: (10:21)

To verify Equation 10.20 it is enough to verify (10.21).

Commands Results Comments


n ¼ 0:50; 3 The left side of (10.21) is
Convolution
x1 ¼ 0.9.^n; 2.5 computed for the
x2 ¼ 0.8.^n; 2 discrete-time signals
y ¼ conv(x1,x2); 1.5 x1[n] ¼ 0.9n, 0  n  50
stem(0:100,y) 1
and x2[n] ¼ 0.8n,
legend 0  n  50. The result
0.5
('convolution'); of their convolution
0
0 10 20 30 40 50 60 70 80 90 100 is plotted.

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{x* [n]} ¼ X* (z*): (10:22)

Commands Results Comments


syms n z Equation 10.22 is verified using the signal
x ¼ (2þ3*i)^n; x[n] ¼ (2 þ 3i)n u[n]. First, the left side of
Left ¼ z=(2þ3*iþz)
xc ¼ conj(x); Equation 10.22 is computed.
Left ¼ ztrans(xc)

x ¼ (2þ3*i)^n; The right side is derived by first computing


X ¼ ztrans(x,z); the conjugate of X(z) and then
Right ¼ (2þ3*i)*z =
Xc ¼ conj(X); substituting z by z*.
(2*zþ3*i*z-13)
Right ¼ subs
(Xc,z,conj(z))
The difference of the two sides is zero, so
simplify(Right-Left) ans ¼ 0 property (10.22) is confirmed.
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 459 8.4.2010 4:55am Compositor Name: PG1421

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[0] ¼ lim X(z)


z!1
x[1] ¼ lim [zX(z)  zx[0]]
z!1
.. (10:23)
.
x[m] ¼ lim [zm X(z)  zm x0  zm1 x[1]      zx[m  1]]
z!1

Commands Results Comments


syms n z Suppose that x[n] ¼ (n þ 1)2u[n]. Thus, x[0] ¼ 1, x[1] ¼ 4,
x0 ¼ 1
x ¼ (nþ1)^2; x(2) ¼ 9, etc.

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

Commands Results Comments


syms n z The limit when n ! 1 is computed for the sequence
x ¼ 0.8^n; ans ¼ 0 x[n] ¼ 0.8nu[n] (left side of (10.24)).
limit(x,n,inf)

X ¼ ztrans(x,z); The middle side of (10.24) is computed and is equal to


ans ¼ 0
limit((z-1)*X,z,1) the left one.

The right side of (10.24) is computed and is also equal to


limit((1-z^-1)*X,z,1) ans ¼ 0
the left one. Hence, the final value theorem is verified.

10.6 Partial Fraction Expansion of a Rational Function


The z-transform of a sequence is usually expressed as a rational function of z, i.e., it is
written as a ratio of two polynomials of z. The mathematical expression is

B(z) bm zm þ bm1 zm1 þ    þ b1 z þ b0


X(z) ¼ ¼ , (10:25)
A(z) an zn þ an1 zn1 þ    þ a1 z þ a0
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 460 8.4.2010 4:55am Compositor Name: PG1421

460 Signals and Systems Laboratory with MATLAB1

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:

1. The roots li are distinct, that is, every


Q root appears only once. In this case, the
denominator is factored as A(z) ¼ an ni¼1 z  li and the signal X(z) is written as

c1 c2 cn
X(z) ¼ þ þ  þ , (10:26)
z  l1 z  l2 z  ln

where the coefficients c1, . . . , cn are computed according to

ci ¼ lim [(z  li )X(z)]: (10:27)


z!li

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

Commands Results Comments


The vector containing the
A ¼ [1 5 2 8]; coefficients of the denominator
ro ¼ 4.0000 2.0000 1.0000
ro ¼ roots(A) polynomial is defined
and its roots are computed.

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

z2 þ 3z þ 1 1=2 1=6 1=3


X(z) ¼ ¼ þ þ :
z þ 5z þ 2z  8 z þ 4 z þ 2 z  1
3 2

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

The coefficients c1,   , cn are given by

1 dri [(z  l1 )r X(z)]


ci ¼ lim , i ¼ 1, . . . , r:
z!l1 (r  i)! dzri (10:29)
ci ¼ lim (z  li )X(z), i ¼ r þ 1, . . . , n
z!li

Example
Express in partial fraction expansion form the signal
z2 þ 3z þ 1
X(z) ¼ :
z3  3z þ 2

Commands Results Comments


First, the roots of the denominator are calculated.
A ¼ [1 0 3 2]; rt ¼ 2.0000 1.0000 The root l ¼ 1 is repeated two times. Notice
rt ¼ roots(A) 1.0000 that the coefficient of z2 is zero and must be
taken into account when formulating matrix A.

syms z X ¼ (z^2þ3*zþ1)= The coefficient c1 is computed according


(z^33*zþ2); to the lower part of (10.29).
c1 ¼ 1=9
c1 ¼ limit((z-rt(1))*
X,z,rt(1))

In order to compute the coefficients c2 and


c3 (that correspond to i ¼ 1 and i ¼ 2,
r¼2
respectively), we set r ¼ 2 as there are two
repeated roots. First, we compute coefficient c2.

f ¼ ((z1)^r )*X; Calculation of (z  l1)rX(z).


dri [(z  l1 )r X(z)]
di ¼ diff(f,z,r1); Calculation of .
dzri
1
Calculation of . Notice that i ¼ 1
fact ¼ 1=factorial(r1); (r  i)!
when calculating c2.

Coefficient c2 is computed according


c2 ¼ limit(fact*di,z,1) c2 ¼ 10=9
to the upper part of (10.29).

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

10.6.1 Commands residue and residuez


As illustrated in Chapter 9, a signal in rational form can be expressed in partial fraction
form by using the command residue. The command residue is used to confirm the
result of the previous example.
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 462 8.4.2010 4:55am Compositor Name: PG1421

462 Signals and Systems Laboratory with MATLAB1

Example
Express in partial fraction form the signal

z2 þ 3z þ 1
X(z) ¼ :
z3  3z þ 2

Commands Results Comments

num ¼ [ 1 3 1]; The coefficients of numerator


den ¼ [ 1 0 3 2] and denominator polynomials
are defined as usual.

[R,P,K] ¼ residue R ¼ 0.1111 1.1111 1.6667 X(z) is expressed in partial


(num,den) P ¼ 2.0000 1.0000 1.0000 fraction form as
K ¼ [] 0:1111 1:1111 1:6667
X(z) ¼ þ þ ,
zþ2 z1 (z  1)2
which is the same result to the one
obtained with the analytical way.

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

Commands Results Comments


n ¼ [ 3 8 0 4] R ¼ 20 3 The partial fraction expansion of X(z) is
d ¼ [ 1 5 4]; P ¼ 4 1 20 3
X(z) ¼ þ þ 3z  7.
[R,P,K] ¼ residue(n,d) K¼3 7 zþ4 zþ1

The obtained result is confirmed by using the reverse syntax of the residue command.

Commands Results Comments

R ¼ [ 20 3]; B¼3 8 0 4 The rational function


P ¼ [4 1]; A¼1 5 4 B(z) 3z3 þ 8z2 þ 4
K ¼ [3 7]; X(z) ¼ is X(z) ¼ 2 .
A(z) z þ 5z þ 4
[B,A] ¼ residue(R,P,K)

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

of the numerator and denominator polynomials, respectively, in ascending powers of z1,


that is, X(z) is of the form

B(z) b0 þ b1 z1 þ b2 z2 þ    þ bm zm


X(z) ¼ ¼ : (10:30)
A(z) a0 þ a1 z1 þ a2 z2 þ    þ an zn

The outcome of the command residuez is analyzed according to

r1 r2 rn
X(z) ¼ þ þ  þ þ K(z), (10:31)
1  p1 z1 1  p2 z1 1  pn z1

where K(z) ¼ k0 þ k1 z1 þ   . If there is a root p1 of multiplicity q, the outcome of the


command residuez is analyzed according to

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

1  8z1 þ 17z2 þ 2z3  24z4


X(z) ¼ :
1 þ z1  2z2

Commands Results Comments

n ¼ [ 1 8 17 2 24]; R¼5 4 The partial fraction expansion of


d ¼ [1 1 2]; P ¼ 2 1 5 4
X(z) is X(z) ¼ þ þ 5z1 þ 12z2 .
[R,P,K] ¼ residuez(n,d) K¼0 5 12 1 þ 2z1 1  z1

10.7 Using the z-Transform to Solve Difference Equations


In this section, we introduce a method for solving linear difference equations with constant
coefficients by using the z-transform. For simplicity, we assume that the signals are causal,
i.e., are zero for n  0. In Section 10.8, an example of a difference equation with nonzero
initial conditions is given. The basic property that is used to find the solution of a difference
equation by employing the z-transform is the shifting property that for causal signals
simplifies to

Z{x[n  m]} ¼ zm X(z): (10:33)


Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 464 8.4.2010 4:55am Compositor Name: PG1421

464 Signals and Systems Laboratory with MATLAB1

The general form of a difference equation is

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

1. The z-transform is applied to both sides of the difference equation.


2. Due to the linearity property, the z-transform of a sum equals the sum of the
partial z-transforms. Moreover, the scalars bk and ak are intergraded out of the
z-transforms.
3. The z-transforms of the shifted signals x[n  k], y[n  k] are evaluated according to
(10.33).
4. The algebraic equation that comes up is solved for Y(z).
5. The inverse z-transform of Y(z) is calculated, that is, the sequence y[n] is computed.
The sequence y[n] is the solution of the difference equation.

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.

From (10.33) we get

Z{y[n]} ¼ Y(z): (10:35)


Z{y[n  1]} ¼ z1 Z{y[n]} ¼ z1 Y(z): (10:36)
2 2
Z{y[n  2]} ¼ z Z{y[n]} ¼ z Y(z): (10:37)

The computational procedure is as follows.

1. Applying z-transform to both parts of the differential equation yields


Z{y[n] þ 0:5y[n  1] þ 2y[n  2]} ¼ Z{0:9n u[n]}.
2. Due to the linearity property, we get
z
Z{y[n]} þ 0:5Z{y[n  1]} þ 2Z{y[n  2]} ¼ ,
z  0:9
z
where the z-transform pair an u[n] $ is used.
za
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 465 8.4.2010 4:55am Compositor Name: PG1421

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)

5. The solution y[n] of the difference equation is obtained by applying inverse


z-transform to Y(z), i.e., y[n] ¼ Z1{Y(z)}.

A similar computational procedure is implemented in MATLAB in order to compute the


solution of the given difference equation.

Commands Results Comments


syms n z Y Y(z) is denoted by Y.
X ¼ ztrans The z-transform of the right side of the
(0.9^n,z) difference equation is computed.
Y1 ¼ z^(1)*Y; The z-transform of y[n  1], that is, This is the crucial point of the
Z{y[n  1]} is defined according computational procedure. The term
to (10.36). The result is assigned X is moved to the left side of the
to variable Y1. difference equation and the whole
left side is assigned to a term G
Y2 ¼ z^(2)*Y; Z{y[n  2]} is denoted by Y2 and is
defined according to (10.37).
G ¼ Yþ0.5*Y1þ The term G is a function of Y and z. Using the command solve allows us
2*Y2X; to solve for Y. This is the solution
of the differential equation expressed
in the z-domain. The obtained
solution is same to the analytically
computed solution.
SOL ¼ solve(G,Y);
pretty(SOL);

y ¼ iztrans z3 Applying inverse z-transform yields


.
(SOL,n); (z  0:9)(z2 þ 0:5z þ 2) the solution y[n] of the difference
equation.
(continued)
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 466 8.4.2010 4:55am Compositor Name: PG1421

466 Signals and Systems Laboratory with MATLAB1

(continued)

Commands Results Comments


10
n1 ¼ 0:10; y[n] The sequence y[n] is
5
y_n ¼ subs defined as a symbolic
(y,n,n1); stem 0 expression, thus in order
(n1,y_n) legend −5
to implement its graph,
('y[n]') xlim the symbolic variable n is
−10
([.5 10.5]) substituted by a vector.
−15

−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.

Commands Results Comments


yn1 ¼ subs(y,n,n1); The terms y[n  1] and y[n  2] are computed from
yn2 ¼ subs(y,n,n2); the derived sequence y[n].
The obtained sequence y[n] is indeed the solution
test ¼ yþ0.5*yn1þ2* yn20.9^n;
test ¼ 0 of the difference equation
test ¼ simplify(test) y[n] þ 0:5y[n  1] þ 2y[n  2] ¼ 0:9n .

10.8 Solved Problems


Problem 1

a. Compute the z-transform of the sequence f1[n] ¼ [3,5,6,7,8], 2  n  2.


b. Compute the z-transform of the sequence f2[n] ¼ [3,5,6,7,8], 0  n  4.

Solution

a. f ¼ [3,5,6,7,8]; The z-transform F1(z) of the sequence f1[n] ¼ [3,5,6,7,8],


n ¼ 2:2; syms z  2  n  2 is 3z2 þ 5z þ 6 þ 7z1 þ 8z2.
F ¼ sum(f.*(z.^-n))
pretty(F)
b. n ¼ 0:4; The z-transform F2(z) of the sequence f2[n] ¼ [3,5,6,7,8],
F ¼ sum(f.*(z.^-n)); 0  n  4 is  3 þ 5z1 þ 6z2 þ 7z3 þ 8z4.
pretty(F)

Problem 2

a. Compute the z-transform of the discrete-time signal x[n] ¼ 2nu[n].


b. Confirm your result by computing the inverse z-transform of your outcome.
Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 467 8.4.2010 4:55am Compositor Name: PG1421

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

a. Compute the z-transform of the discrete-time signal x[n] ¼ cos(2pn)u[n].


b. Confirm your answer by computing the inverse z-transform of your outcome.

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

num ¼ [ 2 3] R ¼ 3.0000 1.0000


den ¼ [ 1 5 6]; P ¼ 3.0000 2.0000
[R,P,K] ¼ residue(num,den) K ¼ []
3 1
The partial fraction form of X(z) is X(z) ¼  .
zþ3 zþ2
a. syms n z ans ¼ 1=2*charfcn[0](n)þ1=2*
X ¼ (2*zþ3)=(z^2þ5*zþ6); (2)^n-(3)^n
iztrans(X,n)
b. X ¼ 3=(zþ3)1=(zþ2) ans ¼ 1=2*charfcn[0](n)þ1=2*
iztrans(X,n) (2)^n-(3)^n

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

468 Signals and Systems Laboratory with MATLAB1

Problem 5 Compute the z-transform of the discrete-time signal


(
0:9n , 0  n  3
f [n] ¼ 2n , 4  n  6
1, 7  n  10

a. With use of the command ztrans.


b. Without using the command ztrans.
c. Confirm your result by computing the inverse z-transform of your outcome.

Solution
First, the signal f [n] is defined as a single symbolic expression. The three-part function f [n]
is written as

f [n] ¼ f1 [n](u[n]  u[n  n1 ]) þ f2 [n](u[n  n1 ]  u[n  n3 ]) þ f3 [n](u[n  n2 ]  u[n  n3 ]),

where f1 ¼ 0.9n, f2 ¼ 2n, f3 ¼ 1, n1 ¼ 4, n2 ¼ 7, and n3 ¼ 11. For confirmation, f [n] is plotted


according to the technique of plotting multipart functions and according to the derived
single symbolic expression.

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

470 Signals and Systems Laboratory with MATLAB1

Problem 6

a. Using z-transform find the solution of the difference equation y[n] 


y[n  1] ¼ u[n].
b. Plot the solution for 0  n  50.
c. Confirm your result by inserting the obtained solution in the difference
equation.

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)

Problem 8 Use z-transform to find the solution of the difference equation


y[n] þ 1:5y[n  1] þ 0:5y[n  2] ¼ x[n] þ x[n  1], where x[n] ¼ 0.8n u[n].

a. Plot the solution for 0  n  20.


b. Confirm your result by inserting the obtained solution in the difference equation.

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

472 Signals and Systems Laboratory with MATLAB1

(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)

Problem 9 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.9nu[n] and the initial condi-
tions are y[1] ¼ 1, y[2] ¼ 2. Moreover, verify your answer

a. By examining if the derived solution satisfies the difference equation


b. By computing the solution with use of the command filter

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

syms n z Y The initial conditions of


x ¼ 0.9^n; y[n] are taken into
X ¼ ztrans(x,z); account at the
X1 ¼ z^(1)*X; definition of the
y_1 ¼ 1; z-transforms of y
y_2 ¼ 2 Y1 ¼ [n  1] and y[n  2],
z^(1)* and the solution of the
Yþy_1; difference equation
Y2 ¼ z^(2)* with nonzero initial
Yþy_2þ(z^1) conditions is
*y_1; G ¼ 2*Y-3* y ¼ 9=8*
Y1þY2-XþX1; (1=2)^nþ9=8*
SOL ¼ solve (9=10)^n
(G,Y);
y ¼ iztrans
(SOL,n)
0.7
y[n] from z−transform
n1 ¼ 0:50; 0.6
y_n ¼ subs 0.5
(y,n,n1);
0.4 Graph of the solution
stem(n1,y_n)
0.3 y[n]
title
('y[n] from 0.2
z-Transform'); 0.1

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

474 Signals and Systems Laboratory with MATLAB1

10.9 Homework Problems


1. Compute the z-transform of the signal u[n] þ nu[n] þ n2 u[n].
2. Compute the z-transforms of the signals u[n] and u[n]. Determine the ROC for
each case.
1
3. Confirm the z-transform pair d[n  k] $ k .
z
zk  1
4. Verify the z-transform pair u[n]  u[n  k] $ k .
z  zk1
z2
5. Confirm the z-transform pair (n þ 1)u[n] $ .
(z  1)2
z2 þ z
6. Verify the z-transform pair n2 u[n] $ .
(z  1)3
1
7. Verify that Z{x[n] cos (v0 n)} ¼ (X(ejv0 z) þ X(ejv0 z).
2
j
8. Confirm that Z{x[n] sin (v0 n)} ¼ (X(ejv0 z)  X(ejv0 z).
2
dX(z) d2 X(z)
9. Verify that Z{n2 x[n]} ¼ z þ z2 .
dz dz2
10. Suppose that x[n] is a complex-valued sequence. Verify that
1
a. Re{x[n]} ¼ (X(z) þ X* (z*))
2
1
b. Im{x[n]} ¼ (X(z)  X* (z*))
2j
11. Confirm that Z{x[n]  x[n  1]} ¼ (1  z1)X(z).
12. Verify that
( )
X
n
1
Z x[k] ¼ X(z):
k¼1
1  z1

13. Express in partial fraction form the signal

2z2 þ z  1
X(z) ¼ :
z3  3z þ 2

Verify your answer by expressing the derived function in rational form.

14. Express in partial fraction form the signal

z3  3z þ 2
X(z) ¼ :
2z2 þ z  1

Verify your answer by expressing the derived function in rational form.


Palamides/Signals and Systems Laboratory with MATLAB1 K11500_C010 Page Proof page 475 8.4.2010 4:55am Compositor Name: PG1421

z-Transform 475

15. Express in partial fraction form the signal

12  46z1 þ 34
X(z) ¼ :
1 þ 7z1 þ 16z2  12z3

Verify your answer by expressing the derived function in rational form.

16. Express in partial fraction form the signal

1 þ 7z1 þ 16z2  12z3


X(z) ¼ :
12  46z1 þ 34

Verify your answer by expressing the derived function in rational form.

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

You might also like