LABEX3
LABEX3
ng V Dng 12141039
Section:
LaboratoryExercise3
DISCRETETIMESIGNALS:FREQUENCYDOMAINREPRESENTATIONS
3.1
Project 3.1
DTFT Computation
% Program P3_1
% Evaluation of the DTFT
clf;
% Compute the frequency samples of the DTFT
w = -4*pi:8*pi/511:4*pi;
%num=[1 1 1 1 1];den=1;
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 in radians');
Answers:
Q3.1 The expression of the DTFT being evaluated in Program P3_1 is
pausecommand istopauseexecutionofaMatlabprogram.
Q3.2 The plots generated by running Program P3_1 are shown below :
Amplitude
8
6
4
2
0
-4
-3
-2
4
Amplitude
-1
2
0
-2
-4
-4
-3
-2
-1
Amplitude
8
6
4
2
0
-4
-3
-2
2
Phase in radians
-1
1
0
-1
-2
-4
-3
The DTFT is a
Its period is
-2
-1
__periodic_ function of .
clf;
N = 512;
num = [0.7 -0.5 0.3 1];
den = [1 0.3 -0.5 0.7];
[h,w] = freqz(num, den, N);
% 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 in radians');
The plots generated by running the modified Program P3_1 are shown below :
Amplitude
1
0.5
0
-0.5
-1
0.1
0.2
0.3
0.5
0.6
0.7
0.8
0.9
0.7
0.8
0.9
0.8
0.9
0.8
0.9
1
Amplitude
0.4
0.5
0
-0.5
-1
0.1
0.2
0.3
0.4
0.5
0.6
Amplitude
1
1
1
1
0.1
0.2
0.4
0.5
0.6
0.7
4
Phase in radians
0.3
2
0
-2
-4
0.1
0.2
0.3
0.4
0.5
0.6
0.7
The DTFT is a
Its period is - 2
The jump in the phase spectrum is caused by -
unwrapis as given
Phase in radians
-1
-2
-3
-4
-5
-6
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Q3.4 The required modifications to Program P3_1 to evaluate the given DTFT of Q3.4 are given
below:
clf;
%ComputethefrequencysamplesoftheDTFT
w=4*pi:8*pi/511:4*pi;
num=[1357911131517];
den=1;
h=freqz(num,den,w);
%PlottheDTFT
subplot(2,1,1)
plot(w/pi,real(h));grid
title('RealpartofH(e^{j\omega})')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,1,2)
plot(w/pi,imag(h));grid
title('ImaginarypartofH(e^{j\omega})')
xlabel('\omega/\pi');
ylabel('Amplitude');
pause
subplot(2,1,1)
plot(w/pi,abs(h));grid
title('MagnitudeSpectrum|H(e^{j\omega})|')
xlabel('\omega/\pi');
ylabel('Amplitude');
subplot(2,1,2)
plot(w/pi,angle(h));grid
title('PhaseSpectrumarg[H(e^{j\omega})]')
xlabel('\omega/\pi');
ylabel('Phaseinradians');
The plots generated by running the modified Program P3_1 are shown below :
Amplitude
100
50
0
-50
-4
-3
-2
-1
100
50
0
-50
-100
-4
-3
-2
-1
Amplitude
100
50
0
-4
-3
-2
-1
4
Phase in radians
Amplitude
2
0
-2
-4
-4
-3
-2
-1
The DTFT is a
periodicfunction of.
Its period is - 2
The jump in the phase spectrum is caused by angle
Project 3.2
DTFT Properties
Answers:
Q3.6
The plots generated by running the modified program are given below :
40
20
20
0
-1
-0.5
0.5
0
-1
-0.5
0.5
-2
-2
-4
-1
-0.5
0.5
-4
-1
-0.5
0.5
Program P3_2 was run for the following value of the time-shift
D=2
The plots generated by running the modified program are given below :
40
20
20
0
-1
-0.5
0.5
0
-1
-0.5
0.5
-2
-2
-4
-1
-0.5
0.5
-4
-1
-0.5
0.5
Q3.9
Program P3_2 was run for the following values of the time-shift and for the following
values of length for the sequence D=4andD=14
The plots generated by running the modified program are given below :
40
20
20
0
-1
-0.5
0.5
0
-1
-0.5
0.5
-2
-2
-4
-1
-0.5
0.5
-4
-1
-0.5
0.5
40
20
20
0
-1
-0.5
0.5
0
-1
-0.5
0.5
-2
-2
-4
-1
-0.5
0.5
-4
-1
-0.5
0.5
wo
The plots generated by running the modified program are given below :
40
20
20
0
-1
-0.5
0.5
0
-1
-0.5
0.5
-2
-2
-4
-1
-0.5
0.5
-4
-1
-0.5
0.5
Program P3_3 was run for the following value of the frequency-shift 0.5
The plots generated by running the modified program are given below :
40
20
20
0
-1
-0.5
0.5
0
-1
-0.5
0.5
-2
-2
-4
-1
-0.5
0.5
-4
-1
-0.5
0.5
Program P3_3 was run for the following values of the frequency-shift and for the
following values of length for the sequence
L=4,wo=0.2
The plots generated by running the modified program are given below :
2
-1
-0.5
0.5
2
-1
-0.5
0.5
-2
-2
-4
-1
-0.5
0.5
-4
-1
-0.5
0.5
Q3.15
The plots generated by running the modified program are given below :
100
50
0
-1
4
50
-0.5
0.5
0
-1
-2
-2
-0.5
0.5
0.5
-4
-1
-0.5
-4
-1
-0.5
0.5
Q3.16
Program P3_4 was run for the following two different sets of sequences of varying
lengths
Length of x1=7; x1 = [1 3 5 7 9 11 13];
Length of x2=7; x2 = [1 -2 3 -2 1 -2 3];
The plots generated by running the modified program are given below :
100
50
0
-1
4
50
-0.5
0.5
0
-1
-2
-2
-0.5
0.5
0.5
-4
-1
-0.5
-4
-1
-0.5
0.5
Q3.18
The plots generated by running the modified program are given below :
100
50
0
-1
-0.8
-0.6
-0.4
-0.2
0.2
0.4
0.6
0.8
0.8
0.8
10
5
0
-1
-0.8
-0.6
-0.4
-0.2
0.2
0.4
0.6
100
50
0
-1
-0.8
-0.6
-0.4
-0.2
0.2
0.4
0.6
Program P3_5 was run for the following two different sets of sequences of varying
lengths
Length of x1=10; x1 = [1 3 5 7 9 11 13 15 17 19 21];
Length of x2=10; x2 = [1 -1 1 -1 1 -1 1 -1 1 -1 1];
The plots generated by running the modified program are given below:
200
100
0
-1
-0.8
-0.6
-0.4
-0.2
0.2
0.4
0.6
0.8
0.8
0.8
20
10
0
-1
-0.8
-0.6
-0.4
-0.2
0.2
0.4
0.6
200
100
0
-1
-0.8
-0.6
-0.4
-0.2
0.2
0.4
0.6
From
these plots we make the following observations :
Q3.20
Theoriginalrampsequenceisnonzerofor0n3.
Q3.21
The plots generated by running the modified program are given below :
2
-1
-0.5
0.5
2
-1
-0.5
0.5
-2
-2
-4
-1
-0.5
0.5
-4
-1
-0.5
0.5
Boththeoriginalandtime
Program P3_6 was run for the following two different sets of sequences of varying
lengths
Length of num = 10,; num = [1 2 3 4 5 6 7 8 9 10]
The plots generated by running the modified program are given below :
40
20
20
0
-1
-0.5
0.5
0
-1
-0.5
0.5
-2
-2
-4
-1
-0.5
0.5
-4
-1
-0.5
0.5
From
these plots we make the following observations :
TheDTFTofthetimereversedsequenceisafrequencyreversedversionoftheDTFTof
theoriginalsequence
3.3
z-TRANSFORM
Project 3.5
Analysis of z-Transforms
Answers:
Q3.46
The frequency response of the z-transform obtained using Program P3_1 is plotted
below:
Q3.47
The 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 rational ztransform is given below :
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);
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
1.0000
2.0000
0.5000
3.0000
0.5000
k=
0.4000
G(z) 0.4
1 2z 3z
1 0.5z 0.5z
1
2
1
2
1 9.2293z 2.4344z 1 0.2293z 0.0822z
G(z)of Q3.46:
4
3
Imaginary Part
2
1
0
-1
-2
-3
-4
-9
Q3.48
-8
-7
-6
-5
-4
-3
Real Part
-2
-1
From the pole-zero plot generated in Question Q3.47, the number of regions of convergence
(ROC) ofG(z)are4
All possible ROCs of this z-transform are sketched below :
R1 :
R2 :
R3 :
R4 :
| z | 0.2718(leftsided,notstable)
0.2718 | z | 0.2866(twosided,notstable)
0.2866| z | 8.9576(twosided,stable)
| z | 8.9576(rightsided,notstable)
The MATLAB program to compute and display the rational z-transform from its zeros, poles
and gain constant is given below :
% Program Q3_49
% 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.90009.36000.66301.01400.5850
den=1.00000.95000.17500.66250.3187
1
Project 3.6
Inverse z-Transform
Answers:
Q3.50
The MATLAB program to compute the first Lsamples of the inverse of a rational z-transform
is given below :
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]');
45
x 10
0
-2
h[n]
-4
-6
-8
-10
-12
-14
-16
Q3.51
10
15
20
25
30
Time Index n
35
40
45
50
p=
-8.9576 + 0.0000i
0.1147 + 0.2627i
0.1147 - 0.2627i
-0.2718 + 0.0000i
k=
3.0000
G(z)
1.0254
0.3547
j 1.0254
0.3547
j
0.8601
1
1
1
1 8.9576z 1(0.11470.2627j)z
1(0.11470.2627j)z 1
1
0.2718z
0.3109
Signature: