You are on page 1of 23

DIGITAL SIGNAL PROCESSING USING

MATLAB
LECTURE 3: Z-TRANSFORM
Pn. Aqilah Baseri Huddin
Prof. Dr. Salina A. Samad
DEFINITION OF Z-TRANSFORM



The z-transform of a discrete-time signal x[n] is defined as the
power series


In MATLAB:
>> help ztrans
Example: Find z-transform of =


>> syms n
>> f = cos((pi*n)/2);
>> ztrans(f)
ans =
z^2/(z^2 + 1)

= =
n
z n x n x Z z X ] [ )} ( { ) (
PROPERTIES OF Z-TRANSFORM
Property
1 Linearity
1

1
+
2

2

1

1
+
2

2

2 Time-shifting ( )

()
3 Scaling

() (
1
)
4 Time reversal () (
1
)
5 Differentiation

()


6 Multiplication

1
()
2
()
1
2

1
()
2
(

)
1


7 Convolution
1

2
()
1
()
2
()
Example 1:
Let
1
= 2 + 3
1
+4
2
,
2
= 3 +4
1
+5
2
+6
3

Find
3
=
1
()
2
()

From definition of the z-transforms,








Hence














| |
= =

} 6 , 5 , 4 , 3 { ) ( } 4 , 3 , 2 { ) (
2 1
n x n x
x1 = [2,3,4]; x2 = [3,4,5,6];
x3 = conv(x1,x2)

x3 =
6 17 34 43 38 24
5 4 3 2 1
3
24 38 43 34 17 6

+ + + + + = z z z z z ) z ( X
PROPERTIES OF Z-TRANSFORM
PROPERTIES OF Z-TRANSFORM
Example 2:
We can use the conv_m function in to multiply two z-domain
polynomials corresponding to noncausal sequences:
Let
1
= + 2 + 3
1
,
2
= 2
2
+ 4
1
+ 3 + 5
1

Find
3
=
1
()
2
()

From definition of the z-transforms






Therefore X3(z) = 2z
3
+ 8z
2
+ 17z + 23 + 19z
-1
+ 15z
-2


| |
= = } 5 , 3 , 4 , 2 { ) ( } 3 , 2 , 1 { ) (
2 1
n x n x
x1 = [1,2,3]; n1 = [-1:1];
x2 = [2,4,3,5]; n2 = [-2:1];
[x3,n3] = conv_m(x1,n1,x2,n2)
x3 =
2 8 17 23 19 15
n3 =
-3 -2 -1 0 1 2
PROPERTIES OF Z-TRANSFORM
To divide one polynomial by another, we need an inverse operation called
deconvolution.
In Matlab we use deconv, i.e. [p,r] = deconv(b,a) where we are dividing
b by a in a polynomial part p and a remainder r.
Example,
We divide polynomial X
3
(z) in Example 1 by X
1
(z):












x3 = [6,17,34,43,38,24]; x1 = [2,3,4];
[x2, r] = deconv(x3,x1)

x2 =
3 4 5 6

r =
0 0 0 0 0 0
Z-TRANSFORM PAIRS












Z-TRANSFORM INVERSION
A Matlab function residuez is available to compute the residue
part and the direct (or polynomial) terms of a rational function in z
-1
.
Let





Therefore we can find the Residues (R), Poles (p) and Direct terms
(C) of X(z).




+


+

=
< <
+ + +
+ + +
=
N M
k
k
k
N
k k
k
x x
N
N
M
M
z C
z p
R
R z R ;
z a .... z a
z b .... z b b
) z ( X
0 1
1
1
1
1
1 0
1
1
[R, p, C] = residuez(b,a)
Z-TRANSFORM INVERSION
Lets look at an example:
Consider the rational function:
First rearrange X(z) so that it is a fucntion in ascending powers of z
-1
:



Use matlab:







1 4 3
) (
2
+
=
z z
z
z X
2 1
1
2 2
2
1 4 3 ) 1 4 3 (
) (

+
=
+

=
z z
z
z z z
z z
z X
b = [0,1]; a = [3,-4,1];
[R,p,C] = residuez(b,a)
R =
0.5000
-0.5000
p =
1.0000
0.3333
C =
[]
Z-TRANSFORM INVERSION
We obtain:


To convert back to the rational function form:







So that we get:


1 1
3
1
1
2
1
1
2
1

=
z z
) z ( X
[b,a] = residuez(R,p,C)
b =
0.0000
0.3333
a =
1.0000
-1.3333
0.3333

2 1
1
3
1
3
4
1
3
1

+
=
z z
z
) z ( X
Z-TRANSFORM INVERSION
Another example, compute the inverse z-transform:

9 0
9 0 1 9 0 1
1
1 2 1
. z ,
) z . ( ) z . (
) z ( X >
+
=

b = 1; a = poly([0.9,0.9,-0.9])
a =
1.0000 -0.9000 -0.8100 0.7290
[R,p,c] = residuez(b,a)
R =
0.2500 + 0.0000i
0.5000 - 0.0000i
0.2500
p =
0.9000 + 0.0000i
0.9000 - 0.0000i
-0.9000
c = []
Z-TRANSFORM INVERSION




Using table 4.1:


) ( ) 9 . 0 ( 25 . 0 ) 1 ( ) 9 . 0 )( 1 (
9 . 0
5 . 0
) ( ) 9 . 0 ( 25 . 0 ) (
1
n u n u n n u n x
n n n
+ + + + =
+
Matlab verification:


[delta,n] = impseq(0,-1,7);
x = filter(b,a,delta) % check sequence
x =
Columns 1 through 7
0 1.0000 0.9000 1.6200 1.4580 1.9683 1.7715
Columns 8 through 9
2.1258 1.9132


x = (0.25)*(0.9).^n + (0.5)*(n+1).*(0.9).^n + (0.25)*(-0.9).^n % answer
sequence
x =
Columns 1 through 7
0 1.0000 0.9000 1.6200 1.4580 1.9683 1.7715
Columns 8 through 9
2.1258 1.9132
Z-TRANSFORM INVERSION
Another Example. Determine the inverse z-transform of


so that the resulting sequence is causal and contains no complex
numbers.
We will have to find the poles of X(z) in the polar form to determine the
ROC of the causal sequence.

2 1
1
64 0 2 8 0 1
2 4 0 1

+
+
=
z . z .
z .
) z ( X
b = [1,0.4*sqrt(2)]; a=[1,-0.8*sqrt(2),0.64];
[R,p,C] = residuez(b,a)
R = 0.5000 - 1.0000i
0.5000 + 1.0000i
p = 0.5657 + 0.5657i
0.5657 - 0.5657i
C = []

Mp=abs(p) % pole magnitudes
Ap=angle(p)/pi % pole angles in pi units
Mp = 0.8000 0.8000
Ap = -0.2500 0.2500
Z-TRANSFORM INVERSION

From the Matlab calculation, we have:
=
.+
|.|

+
.
|.|




And from table 4.1 we have:


sequence sided right to due z > 8 . 0
) n ( u )]
n
sin( )
n
[cos( .
) n ( u )] e e ( j ) e e ( . [ .
) n ( u e . ) j . ( ) n ( u e . ) j . ( ) n ( x
n
n j n j n j n j n
n j n n j n
4
2
4
8 0
5 0 8 0
8 0 5 0 8 0 5 0
4 4 4 4
4 4
t
+
t
=
+ + =
+ + =
t t

t t

t t

Z-TRANSFORM INVERSION
Matlab Verification:





[delta,n] = impseq(0,0,6);
x = filter(b,a,delta) % check sequence
x =

1.0000 1.6971 1.2800 0.3620 -
0.4096 -0.6951 -0.5243

x = ((0.8).^n).*(cos(pi*n/4)+2*sin(pi*n/4)) %
answer sequence
x =

1.0000 1.6971 1.2800 0.3620 -
0.4096 -0.6951 -0.5243
SYSTEMS IN THE Z-DOMAIN
To determine zeros and poles of a rational H(z), we can use
roots for both the numerator and denominator. (poly is the
inverse of root)
We can plot these roots in a pole-zero plot using zplane(b,a).
This will plot poles and zeros given the numerator row/column
vector b and the denominator row/column vector a.
(H(z) = B(z)/A(z))
We can calculate the magnitude and the phase responses of
our system using freqz:






SYSTEMS IN THE Z-DOMAIN
Example:
Given a causal system
y(n) = 0.9y(n-1) + x(n)
a. Find H(z) and sketch its pole-zero plot
b. Plot |H(e
jw
)| and <H(e
jw
).
c. Determine the impulse response h(n)

Solution:
a. y(n) - 0.9y(n-1) = x(n)
Thus, =
1
10.9
1

SYSTEMS IN THE Z-DOMAIN
Solution using Matlab:
a. use zplane function -




>> b = [1,0]; a = [1,-0.9];
>> zplane(b,a);
>> title(Pole-Zero Plot)
-1 -0.5 0 0.5 1
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Real Part
I
m
a
g
i
n
a
r
y

P
a
r
t
Pole-Zero Plot
0 0.9
SYSTEMS IN THE Z-DOMAIN
B. To plot the magnitude and phase response, we use
freqz function:




>> [H,w] = freqz(b,a,100);
>> magH = abs(H); phaH = angle(H);
>>
>> subplot(2,1,1); plot(w/pi,magH); grid
>> xlabel('frequency in pi units'); ylabel('Magnitude');
>> title('Magnitude Response')
>> subplot(2,1,2); plot(w/pi,phaH/pi); grid
>> xlabel('Frequency in pi units'); ylabel('Phase in pi
units');
>> title('Phase Response')
SYSTEMS IN THE Z-DOMAIN
B. The plots:




0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
2
4
6
8
10
12
frequency in pi units
M
a
g
n
i
t
u
d
e
Magnitude Response
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-0.4
-0.3
-0.2
-0.1
0
Frequency in pi units
P
h
a
s
e

i
n

p
i

u
n
i
t
s
Phase Response
SYSTEMS IN THE Z-DOMAIN
B. Points to note:
We see the plots, the points computed is between 0 < < 0.99
Missing point at =
To overcome this, use the second form of freqz:
>> [H,w] = freqz(b,a,200,whole);
>> magH = abs(H(1:101)); phaH = angle(H(1:101));
Now the 101
st
element of the array H will correspond to =

Similar result can be obtained using the third form:
>> w = [0:1:100]*pi/100;
>> H = freqz(b,a,w);
>> magH = abs(H); phaH = angle(H);

Try this
SYSTEMS IN THE Z-DOMAIN
B. Points to note:
Also, note that in the plots we divided the w and phaH
arrays by so that the plot axes are in the units of and easier to
read
This is always a recommended practice!

You might also like