DSP Lab 6 Z-Transform in MATLAB

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Electrical & Computer Engineering Department Engr.

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

Help on these commands is available in MATLAB help directory.


Procedure:
1. Open M-file or M-Book.
2. Save it by any useful name but do not start the name by any numeric digit, do not use any special
character other than under-the score (_) and also remember not to give any space in the name.
3. Firstly, write numerator polynomial and denominator polynomial.
4. Using tf2zp command, convert it into z-plane.
5. Now take its frequency response either using freqz command or DTFT function.
6. Use zplane command to sketch the zplane, poles and zeroes.
7. Now change the location of poles and zeros and analyze the change in frequency response of the
system.

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

Page | COMSATS University Islamabad, Abbottabad Campus


Electrical & Computer Engineering Department Engr. Nauman Tareen

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?

Page | COMSATS University Islamabad, Abbottabad Campus


Electrical & Computer Engineering Department Engr. Nauman Tareen

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.

Special Instructions: (Total marks 10)


 Understanding the lab is a part of assignment
 Late lab assignments will not be considered.
 Bring the hard copy of this lab in next lab.
 Copied assignment will be given zero marks.
 Do proper formatting of lab assign & use appropriate size of plots, with proper labeling.
 Submit the lab assignments in groups.

Page | COMSATS University Islamabad, Abbottabad Campus

You might also like