## Saturday, March 25, 2006

### z-transform, inverse z-transform, filter, freqz, residuez

Like Laplace transform, the Symbolic Toolbox in MATLAB supports symbolic
computation of Z-transform (ztrans) and inverse Z-transform (iztrans):

syms n
x = (0.5)^n;
X = ztrans(x)
X =
2*z/(2*z-1)
iztrans(X)
ans =
(1/2)^n

There are many ways to represent a discrete-time system. For a FIR system, the
most straightforward way is to specify its impulse response.

x = [1 2 3 0 1 -3 4 1]; % input
im = [0.25 0.25 0.25 0.25]; % impulse response
y = conv(x,im);
subplot(2,1,1);
stem(x);
subplot(2,1,2);
stem(y);

To get our previous example on the FIR system, we can use the following command:

y = filter(im,1,x)
y =
0.2500 0.7500 1.5000 1.5000 1.5000 0.2500 0.5000 0.7500

we can implement a IIR filter such as
$$H(z) = \frac{1}{1+0.5Z^{-1}}$$

b = 1;
a = [1 0.5];
y = filter(b,a,x);
subplot(2,1,1);
stem(y)
subplot(2,1,2);
impz(b,a)

To obtain the pole locations, we can use the residuez command:

[r,p,k] = residuez(b,a)
r =
1
p =
-0.5000
k =
[ ]

Pictorially, we can also derive the pole and zero plot using zplane:

zplane(b,a)