You are on page 1of 3

Example: Lets consider a difference equation

1
Z-Transform in Matlab 6 y(n ) − 5 y ( n − 1) + y ( n − 2) = n , n ≥ 0
4
and
Z-transform is defined as y (n − 1) = 1, y (n − 2) = 0

X ( z ) = ∑ x( n) z − n Taking z-transform
6Y ( z ) − 5 {z −1Y ( z ) + y ( −1)} + { z − 2Y ( z ) + z − 1 y ( −1) + y ( −2)} =
n=0 4z
4 z −1
( 6 − 5z + z −2 ) Y ( z ) =
or −1 4z
− z −1 + 5 z −1
X ( z ) = Z [ x(n )] 4z −1
The inverse z-transform is denoted by  1  4 z −1 −1 
Y ( z) =   4 z − 1 − z + 5 z 
x(n ) = Z −1 [ X ( z )] −1
 6 − 5z + z
−2
 
MatLab Symbolic Toolbox gives the z-transform of a function
>> syms z n
Example: >> iztrans((4*z/(4*z-1)-z^-1+5)/(6-5*z^-1+z^-2))
1 2z
x( n ) =
u (n ) X ( z) =
4n 2z −1 ans =
>> syms z n >> syms z n
>> ztrans(1/4^n) >> iztrans(2*z/(2*z-1)) 1/2*(1/4)^n+5/2*(1/2)^n-2*(1/3)^n
Therefore
ans = ans = n
11  51 
n
 1
n

y(n ) =   +   − 2 
2 4 22   3
4*z/(4*z-1) (1/2)^n

ece308-19- 1 ece308-19- 2
In Matlab “deconv” command is used to compute the inverse Therefore
z transform. ( Determine the values of x(n) for few samples)
deconv
Deconvolution and polynomial division
x(0) = 1, x(1) = 4, x(2) = 5, x(3) = −6, x(4) = −32
Syntax
[q,r] = deconv(x,h)
Description
[q,r] = deconv(x,h) deconvolves vector x out of vector h, using long division. The
Partial fraction expansion with MatLab
quotient is returned in vector q and the remainder in vector r such that v = The MatLab function “residuez” may be used to perform
conv(u,q)+r.
partial fraction expansion of a z-transform.
If x and h are vectors of polynomial coefficients, convolving them is equivalent to N ( z ) b0 + b1 z −1 + ... + bM z − M
multiplying the two polynomials, and deconvolution is polynomial division. The result of X ( z) = =
dividing h by x is quotient q and remainder r. D ( z ) a 0 + a1 z −1 + ... + aN z − N
Examples The partial fraction expansion has the form
If x = [1 2 3 4]
N (z ) r1 rN
h = [10 20 30]
= −1
+ ... + + k + k z −1 + ... + k M − N −1 z −( M − N )
the convolution is D( z ) 1 − p1 z 1 − pN z−1 1 2
c = conv(x,h)
c=
10 40 100 160 170 120
Use deconvolution to recover h:
Example: Find the partial fraction expansion of the following
[q,r] = deconv(c,x)
q=
z-transform
10 20 30 1 + 2 z− 1 + z −2
r= X ( z) =
0 0 0 0 0 0 1 − 2 z−1 + 4 z−2
This gives a quotient equal to v and a zero remainder.
Example: >> [r,p,k]=residuez([1,2,1],[1,-2,4])
Find the first five term of the inverse z-transform of
1 + 2z −1 + z −2 r=
X (z) = 0.3750 - 0.9382i
1 − 2 z −1 + 4 z −2
0.3750 + 0.9382i
>> b=[1 2 1];
p=
>> a=[1 -2 4];
1.0000 + 1.7321i
>> n=5; 1.0000 - 1.7321i
>> b=[b zeros(1,n-1)];
>> [x,r]=deconv(b,a); k =
>> disp(x) 0.2500
1 4 5 -6 -32

ece308-19- 3 ece308-19- 4
Pole-zero Diagram
The MatLab function “zplane” can display the pole-zero
diagram

Example:

1
z −1 + z −2
H ( z) = 2
3 −1 2 −2
1+ z + z
5 25

>> b=[0 1 1/2];


>> a=[1 3/5 2/25];
>> zplane(b,a)

Reference: Numerical Methods using MatLab, George


Lindfield, John Penny. Prentice Hall, 2000
Digital Signal processing A Practice Approach, E. C.
Ifeachor, B.W. Jervis, Prentice Hall,2002

ece308-19- 5

You might also like