Lab No: 04
Implementation of Z-Transform and its applications in Discrete Time
system analysis
Introduction:
The z-transform is a useful tool in the analysis of discrete-time signals and systems and is the
discrete-time counterpart of the Laplace transform for continuous-time signals and systems.
The z-transform may be used to solve constant coefficient difference equations, evaluate the
response of a linear time-invariant system to a given input, and design linear filters. In this lab,
we will look at the z-transform and examine how it may be used to solve a variety of different
problems.
Lab Tasks:
Q4.1:
Using Program P6_1 evaluate the following z-transform on the unit circle:
Code:
% Program P4_1
% Evaluation of the z-transform
clf;
% Compute the frequency samples of the z-transform
w = -4*pi:8*pi/511:4*pi;
num = [2 5 9 5 3];den = [5 45 2 1 1];
h = freqz(num, den, w);
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 in radians');
Graph:
Q4.2:
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
Code:
% Program Q4_2
% Given numerator and denominator coefficient vectors for G(z),
% - compute and display poles and zeros
% - compute and display factored form of G(z)
% - generate pole-zero plot
clf;
% initialize
num = [2 5 9 5 3];
den = [5 45 2 1 1];
% compute poles and zeros and display
[z p k] = tf2zpk(num,den);
disp('Zeros:');
disp(z);
disp('Poles:');
disp(p);
input('Hit <return> to continue...');
% compute and display factored form of G(z)
[sos k] = zp2sos(z,p,k)
input('Hit <return> to continue...');
% generate pole-zero plot
zplane(z,p);
Graph:
Zeros:
-1.0000 + 1.4142i
-1.0000 - 1.4142i
-0.2500 + 0.6614i
-0.2500 - 0.6614i
Poles:
-8.9576
-0.2718
0.1147 + 0.2627i
0.1147 - 0.2627i
sos =
1.0000 2.0000 3.0000 1.0000 9.2293 2.4344
1.0000 0.5000 0.5000 1.0000 -0.2293 0.0822
k=
0.4000
Q4.3:
From the pole-zero plot generated in Question Q 4.2, 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?
Answer:
The number of regions of convergence (ROC) of G(z) are - FOUR. The magnitude of the
complex conjugate poles inside the unit circle is 0.2866. All possible ROCs of this z-transform
are sketched below:
From the pole-zero plot it can be seen that the DTFT – You cannot tell if the DTFT exists from
the pole zero plot alone. In order to know this, the region of convergence must be specified.
The DTFT does exist for the sequence obtained by using the ROC R3 shown above. This would
be a stable system with a two-sided impulse response.
Q4.4:
Write a MATLAB program to compute and display the rational z-transform from its zeros, poles
andgain constant. Using this program, determine the rational form of a z-transform whose zeros
are at ξ1=0.3,ξ2=2.5 ,ξ3=-0.2+j 0.4 and ξ4= −0.2-j 0.4 ;the poles are at λ1=0.5 ,λ2=-0.75,λ3=0.6+j
0.5, and λ4=0.6-j 0.7;and the gain constant k is 3.9.
Code:
% Program Q4_4
% Given the poles and zeros of G(z), compute and display the rational
% z-transform.
clf;
% initialize
z = [0.3 2.5 -0.2+i*0.4 -0.2-i*0.4]';
p = [0.5 -0.75 0.6+i*0.7 0.6-i*0.7]';
k = 3.9;
% find numerator and denominator polynomial coefficients
[num den] = zp2tf(z,p,k)
The rational form of a z-transform with the given poles, zeros, and gain is found to be –
num = 3.9000 -9.3600 -0.6630 -1.0140 0.5850
den = 1.0000 -0.9500 0.1750 0.6625 -0.3187
Q4.5:
Write a MATLAB program to compute the first L samples of the inverse of a rational z-transform
where the value of L is provided by the user through the command input. Using this program
compute and plot the first 50 samples of the inverse of
Code:
% Program Q4_5
% Given numerator and denominator coefficient vectors for G(z),
% find and plot the first L samples of the impulse response, where
% the parameter L is input by the user.
clf;
% initialize
num = [2 5 9 5 3];
den = [5 45 2 1 1];
% Query user for parameter L
L = input('Enter the number of samples L: ');
% find impulse response
[g t] = impz(num,den,L)
%plot the impulse response
stem(t,g)
title(['First ',num2str(L),' samples of impulse response']);
xlabel('Time Index n');
ylabel('h[n]');
Graph:
Q6.6
Write a MATLAB program to determine the partial-fraction expansion of a rational z-transform.
Usingthis program determine the partial-fraction expansion of
Code:
% Program Q6_6
% Given numerator and denominator coefficient vectors for G(z),
% find and plot the first L samples of the impulse response, where
% the parameter L is input by the user.
clf;
% initialize
num = [2 5 9 5 3];
den = [5 45 2 1 1];
% partial fraction expansion
[r p k] = residuez(num,den)
The rational form of a z-transform with the given poles, zeros, and gain is found to be –
num = 3.9000 -9.3600 -0.6630 -1.0140 0.5850
den = 1.0000 -0.9500 0.1750 0.6625 -0.3187