DSP Lab 6 Z-Transform in MATLAB
DSP Lab 6 Z-Transform in MATLAB
DSP Lab 6 Z-Transform in MATLAB
Nauman Tareen
LAB 06
Z-Transform in MATLAB & effect of pole and zeros on frequency
response
Objective:
The basic objective of this Lab is to understand Z-Transform in MATLAB. How to find poles/zeros of the
transfer function & Effect of pole and zeros on frequency response?
Commands to be used:
ztrans xlabel freqz zeros sign
stem tf2zp sym figure
zplane ylabel stem abs
title zp2tf ones eps
roots grid on subplot angle
Program P1 can be used to evaluate and plot the DTFT of any equation.
% Program P1
% Evaluation of the DTFT
clf;
% Compute the frequency samples of the DTFT
w = -4*pi:8*pi/511:4*pi;
num = [2 1];den = [1 -0.6];
h = freqz(num, den, w);
% Plot the DTFT
subplot(2,1,1)
plot(w/pi,real(h));grid
title(’Real part of H(e^{j\omega})’)
xlabel(’\omega /\pi’);
ylabel(’Amplitude’);
subplot(2,1,2)
plot(w/pi,imag(h));grid
title(’Imaginary part of H(e^{j\omega})’)
xlabel(’\omega /\pi’);
ylabel(’Amplitude’);
pause
subplot(2,1,1)
plot(w/pi,abs(h));grid
title(’Magnitude Spectrum |H(e^{j\omega})|’)
xlabel(’\omega /\pi’);
ylabel(’Amplitude’);
subplot(2,1,2)
plot(w/pi,angle(h));grid
title(’Phase Spectrum arg[H(e^{j\omega})]’)
xlabel(’\omega /\pi’);
ylabel(’Phase, radians’);
As in the case of the discrete-time Fourier transform, we restrict our attention here to a z-transform G(z) of
a sequence g[n] that is a rational function of the complex variable z−1 and expressed in the form of a ratio
of polynomials in z−1 or in factored form. Some of the operations that are of interest in practice are as
follows.
1. Evaluate the z-transform G(z) on the unit circle, that is, evaluate G(ejω);
2. Develop the pole-zero plot of G(z);
3. Develop the factored form of G(z);
Analysis of z-Transforms
The function freqz can be used to evaluate the values of a rational z-transform on the unit circle. To this
end, Program P1 can be used without any modifications.
Question:
Using Program P1 evaluate the following z-transform on the unit circle:
2 + 5𝑧 −1 + 9𝑧 −2 + 5𝑧 −3 + 3𝑧 −4
𝐺(𝑧) =
5 + 45𝑧 −1 + 2𝑧 −2 + 𝑧 −3 + 𝑧 −4
The pole-zero plot of a rational z-transform G(z) can be readily obtained using the function zplane. There
are two versions of this function. If the z-transform is given in the form of a rational function as in Eq.
above, the command to use is zplane(num, den) where num and den are row vectors containing the
coefficients of the numerator and denominator polynomials of G(z) in ascending powers of z−1. On the
other hand, if the zeros and poles of G(z) are given, the command to use is zplane(zeros, poles) where zeros
and poles are column vectors. In the pole-zero plot generated by MATLAB, the location of a pole is
indicated by the symbol × and the location of a zero is indicated by the symbol◦.
The function tf2zp can be used to determine the zeros and poles of a rational z-transform G(z) . The program
statement to use is [z, p, k] = tf2zp(num,den) where num and den are row vectors containing the coefficients
of the numerator and denominator polynomials of G(z) in ascending powers of z−1 and the output file
contains the gain constant k and the computed zeros and poles given as column vectors z and p, respectively.
The factored form of the z-transform can be obtained from the zero-pole description using the function sos
= zp2sos(z,p,k).
Questions 1:
a. Write a MATLAB program to compute and display the poles and zeros, to compute and display
the factored form, and to generate the pole-zero plot of a z-transform that is a ratio of two
polynomials in z−1. Using this program, analyze the z-transform G(z) of Eq. above.
b. From the pole-zero plot generated in above question, determine the number of regions of
convergence (ROC) of G(z). Show explicitly all possible ROCs . Can you tell from the pole-zero
plot whether or not the DTFT exists?
The reverse process of converting a z-transform given in the form of zeros, poles, and the gain constant to
a rational form can be implemented using the function zp2tf. The program statement to use is [num,den] =
zp2tf(z,p,k).
Question 2:
2
1− 𝑧 −1
3
For the given 𝑥(𝑧) = 3 1 determine the following.
(1+ 𝑧 −1 )(5− 𝑧 −1 )
7 8
a) Pole zero plot using zplane command.
b) Find poles and zeros using both roots and tf2zp commands.
Question 3:
1+3𝑧 −1 −8𝑧 −2
For the given 𝑥(𝑧) = 13 determine the following.
(1− 𝑧 −1 +4𝑧 −2 )
9
a) Find Pole zero plot using zplane command.
b) Find poles and zeros using both roots and tf2zp commands.