Laboratory Exercise 3: Discrete-Time Signals: Frequency-Domain Representations
Laboratory Exercise 3: Discrete-Time Signals: Frequency-Domain Representations
Laboratory Exercise 3: Discrete-Time Signals: Frequency-Domain Representations
GROUP
LABORATORY EXERCISE 3
DISCRETE-TIME SIGNALS: FREQUENCY-DOMAIN REPRESENTATIONS
Answers:
Q3.2 The plots generated by running Program P3_1 are shown below:
1
Real part of H(ej ) Imaginary part of H(ej)
8 4
6 2
Amplitude
Amplitude
4 0
2 -2
0 -4
-4 -2 0 2 4 -4 -2 0 2 4
/ /
Magnitude Spectrum |H(ej)| Phase Spectrum arg[H(ej )]
8 2
Phase in radians
6 1
Amplitude
4 0
2 -1
0 -2
-4 -2 0 2 4 -4 -2 0 2 4
/ /
Its period is - 1
The types of symmetries exhibited by the four plots are as follows : x[n] is a real sequence, so the real and the
magnitude of its DTFT are even symmetry, the imaginary and the phase of its DTFT are odd symmetry.
Q3.3 The required modifications to Program P3_1 to evaluate the given DTFT of Q3.3 are given below:
% Compute the frequency samples of the DTFT
w = 0:pi/511:pi;
num = [0.7 -0.5 0.3 1];den = [1 0.3 -0.5 0.7];
h = freqz(num, den, w);
% Plot the DTFT
subplot(2,2,1)
plot(w/pi,real(h));grid
title('Real part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,2,2)
plot(w/pi,imag(h));grid
title('Imaginary part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,2,3)
plot(w/pi,abs(h));grid
title('Magnitude Spectrum |H(e^{j\omega})|')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,2,4)
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:
2
Real part of H(ej ) Imaginary part of H(ej )
1 1
0.5 0.5
Amplitude
Amplitude
0 0
-0.5 -0.5
-1 -1
0 0.5 1 0 0.5 1
/ /
Magnitude Spectrum |H(ej )| Phase Spectrum arg[H(ej )]
1 4
Phase in radians
2
1
Amplitude
0
1
-2
1 -4
0 0.5 1 0 0.5 1
/ /
Its period is - 1
The jump in the phase spectrum is caused by - The jump in the phase spectrum is caused by an artifact of the
arctangent function inside angle that signify zeros in the frequency response.
The phase spectrum evaluated with the jump removed by the command unwrap is as given below:
Q3.4 The required modifications to Program P3_1 to evaluate the given DTFT of Q3.4 are given below:
% Compute the frequency samples of the DTFT
w = -4*pi:8*pi/511:4*pi;
num = [1 3 5 7 9 11 13 15 17];den = 1;
h = freqz(num, den, w);
% Plot the DTFT
subplot(2,2,1)
plot(w/pi,real(h));grid
title('Real part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,2,2)
3
plot(w/pi,imag(h));grid
title('Imaginary part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,2,3)
plot(w/pi,abs(h));grid
title('Magnitude Spectrum |H(e^{j\omega})|')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,2,4)
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:
50
50
Amplitude
Amplitude
0
0
-50
-50 -100
-4 -2 0 2 4 -4 -2 0 2 4
/ /
Magnitude Spectrum |H(ej )| Phase Spectrum arg[H(ej )]
100 4
Phase in radians
2
Amplitude
50 0
-2
0 -4
-4 -2 0 2 4 -4 -2 0 2 4
/ /
Its period is - 1
The jump in the phase spectrum is caused by an artifact of the arctangent function inside angle that signify
zeros in the frequency response.
Q3.5 The required modifications to Program P3_1 to plot the phase in degrees are indicated below:
plot(w/pi,angle(h)*180/pi);grid
title('Phase Spectrum arg[H(e^{j\omega})]')
xlabel('\omega /\pi');
ylabel('Phase in degrees');
Answers:
Q3.6 The modified Program P3_2 created by adding appropriate comment statements, and adding program
statements for labeling the two axes of each plot being generated by the program is given below:
% Program P3_2
4
% Time-Shifting Properties of DTFT
clf;
w = -pi:2*pi/255:pi; wo = 0.4*pi; D = 10;
num = [1 2 3 4 5 6 7 8 9];
h1 = freqz(num, 1, w);
h2 = freqz([zeros(1,D) num], 1, w);
subplot(2,2,1)
plot(w/pi,abs(h1));grid
title('Magnitude Spectrum of Original Sequence')
subplot(2,2,2)
plot(w/pi,abs(h2));grid
title('Magnitude Spectrum of Time-Shifted Sequence')
subplot(2,2,3)
plot(w/pi,angle(h1));grid
title('Phase Spectrum of Original Sequence')
subplot(2,2,4)
plot(w/pi,angle(h2));grid
title('Phase Spectrum of Time-Shifted Sequence')
The parameter controlling the amount of time-shift is –
w = -pi:2*pi/255:pi; wo = 0.4*pi; D = 10;
num = [1 2 3 4 5 6 7 8 9];
h1 = freqz(num, 1, w);
h2 = freqz([zeros(1,D) num], 1, w);
Q3.7 The plots generated by running the modified program are given below:
40 40
20 20
0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
2 2
0 0
-2 -2
-4 -4
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
From these plots we make the following observations : magnitude spectrum is not changed and phase
spectrum is changed.
Q3.8 Program P3_2 was run for the following value of the time-shift -5
The plots generated by running the modified program are given below:
5
Magnitude Spectrum of Original Sequence
Magnitude Spectrum of Time-Shifted Sequence
60 60
40 40
20 20
0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
2 2
0 0
-2 -2
-4 -4
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
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 = 15;
num = [2 7 9 4 5 1 3 8 4];
The plots generated by running the modified program are given below:
40 40
20 20
0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
2 2
0 0
-2 -2
-4 -4
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
From these plots we make the following observations: for two different sequences of varying
lengths and two different time-shifts, magnitude spectrum is not changed and phase spectrum is
changed.
Q3.10 The modified Program P3_3 created by adding appropriate comment statements, and adding program
statements for labeling the two axes of each plot being generated by the program is given below:
% Frequency-Shifting Properties of DTFT
clf;
6
w = -pi:2*pi/255:pi; wo = 0.4*pi;
num1 = [1 3 5 7 9 11 13 15 17];
L = length(num1);
h1 = freqz(num1, 1, w);
n = 0:L-1;
num2 = exp(wo*i*n).*num1;
h2 = freqz(num2, 1, w);
subplot(2,2,1)
plot(w/pi,abs(h1));grid
xlabel('\omega /\pi');
ylabel('Amplitude');
title('Magnitude Spectrum of Original Seq')
subplot(2,2,2)
plot(w/pi,abs(h2));grid
xlabel('\omega /\pi');
ylabel('Amplitude');
title('Magnitude Spectrum of Frequency-Shifted Seq')
subplot(2,2,3)
plot(w/pi,angle(h1));grid
xlabel('\omega /\pi');
ylabel('Amplitude');
title('Phase Spectrum of Original Seq')
subplot(2,2,4)
plot(w/pi,angle(h2));grid
xlabel('\omega /\pi');
ylabel('Amplitude');
title('Phase Spectrum of Frequency-Shifted Seq')
Q3.11 The plots generated by running the modified program are given below:
Amplitude
50 50
0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
Phase Spectrum of Original Seq Phase Spectrum of Frequency-Shifted Seq
4 4
2 2
Amplitude
Amplitude
0 0
-2 -2
-4 -4
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
From these plots we make the following observations: both magnitude spectrum and phase spectrum is
shifted. The delay is 0.4*pi.
Q3.12 Program P3_3 was run for the following value of the frequency-shift -
7
The plots generated by running the modified program are given below:
From these plots we make the following observations: when the frequency-shift is reatger, the shift is more
than.
Q3.13 Program P3_3 was run for the following values of the frequency-shift and for the following values of length
for the sequence - wo=0.8*pi, num1=17:-2:1
The plots generated by running the modified program are given below:
50 50
0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
Phase Spectrum of Original Seq Phase Spectrum of Frequency-Shifted Seq
2 2
1 1
Amplitude
Amplitude
0 0
-1 -1
-2 -2
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
From these plots we make the following observations:with the change above isn’t change Frequency-Shifting
Property.
Q3.14 The modified Program P3_4 created by adding appropriate comment statements, and adding program
statements for labeling the two axes of each plot being generated by the program is given below:
% Program P3_4
% Convolution Property of DTFT
clf;
w = -pi:2*pi/255:pi;
x1 = [1 3 5 7 9 11 13 15 17];
x2 = [1 -2 3 -2 1];
y = conv(x1,x2);
h1 = freqz(x1, 1, w);
8
h2 = freqz(x2, 1, w);
hp = h1.*h2;
h3 = freqz(y,1,w);
subplot(2,2,1)
plot(w/pi,abs(hp));grid
title('Product of Magnitude Spectra');
xlabel('\omega/\pi');
ylabel('amplitude');
subplot(2,2,2)
plot(w/pi,abs(h3));grid
title('Magnitude Spectrum of Convolved Sequence');
xlabel('\omega/\pi');
ylabel('amplitude');
subplot(2,2,3)
plot(w/pi,angle(hp));grid
title('Sum of Phase Spectra');
xlabel('\omega/\pi');
ylabel('amplitude');
subplot(2,2,4)
plot(w/pi,angle(h3));grid
title('Phase Spectrum of Convolved Sequence');
xlabel('\omega/\pi');
ylabel('amplitude');
Q3.15 The plots generated by running the modified program are given below:
am plitude
50 50
0 0
-1 -0.5 0 0.5 1 -1-0.5 0 0.5 1
/ /
Sum of Phase Spectra Phase Spectrum of Convolved Sequence
4 4
am plitude
am plitude
2 2
0 0
-2 -2
-4 -4
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
From these plots we make the following observations: with two way to compute give the same result.
Q3.16 Program P3_4 was run for the following two different sets of sequences of varying lengths
x1 = [1 3 5 7 9 11 ];
x2 = [1 -2 3 ];
The plots generated by running the modified program are given below:
9
Product of Magnitude Spectra Magnitude Spectrum of Convolved Sequence
80 80
60 60
amplitude
amplitude
40 40
20 20
0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
Sum of Phase Spectra Phase Spectrum of Convolved Sequence
4 4
2 2
amplitude
amplitude
0 0
-2 -2
-4 -4
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
From these plots we make the following observations: the above property is not change.
Q3.17 The modified Program P3_5 created by adding appropriate comment statements, and adding program
statements for labeling the two axes of each plot being generated by the program is given below:
% Program P3_5
% Modulation Property of DTFT
clf;
w = -pi:2*pi/255:pi;
x1 = [1 3 5 7 9 11 13 15 17];
x2 = [1 -1 1 -1 1 -1 1 -1 1];
y = x1.*x2;
h1 = freqz(x1, 1, w);
h2 = freqz(x2, 1, w);
h3 = freqz(y,1,w);
subplot(3,1,1)
plot(w/pi,abs(h1));grid
title('Magnitude Spectrum of First Sequence');
xlabel('\omega/\pi');
ylabel('amplitude');
subplot(3,1,2)
plot(w/pi,abs(h2));grid
title('Magnitude Spectrum of Second Sequence');
xlabel('\omega/\pi');
ylabel('amplitude');
subplot(3,1,3)
plot(w/pi,abs(h3));grid
title('Magnitude Spectrum of Product Sequence');
xlabel('\omega/\pi');
ylabel('amplitude');
Q3.18 The plots generated by running the modified program are given below:
10
Magnitude Spectrum of First Sequence
100
amplitude
50
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
/
Magnitude Spectrum of Second Sequence
10
amplitude
5
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
/
Magnitude Spectrum of Product Sequence
100
amplitude
50
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
/
Q3.19 Program P3_5 was run for the following two different sets of sequences of varying lengths
x1 = [1 3 5 7 9 11 ];
x2 = [1 -2 3 5 7 3 ];
The plots generated by running the modified program are given below:
20
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
/
Magnitude Spectrum of Second Sequence
20
amplitude
10
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
/
Magnitude Spectrum of Product Sequence
200
amplitude
100
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
/
Q3.20 The modified Program P3_6 created by adding appropriate comment statements, and adding program
statements for labeling the two axes of each plot being generated by the program is given below:
11
h2 = freqz(fliplr(num), 1, w);
h3 = exp(w*L*i).*h2;
subplot(2,2,1)
plot(w/pi,abs(h1));grid
xlabel('\omega/\pi');
ylabel('amplitude');
title('Magnitude Spectrum of Original Seq')
subplot(2,2,2)
plot(w/pi,abs(h3));grid
xlabel('\omega/\pi');
ylabel('amplitude');
title('Magnitude Spectrum of Time-Reversed Seq')
subplot(2,2,3)
plot(w/pi,angle(h1));grid
xlabel('\omega/\pi');
ylabel('amplitude');
title('Phase Spectrum of Original Seq')
subplot(2,2,4)
plot(w/pi,angle(h3));grid
xlabel('\omega/\pi');
ylabel('amplitude');
title('Phase Spectrum of Time-Reversed Seq')
Q3.21 The plots generated by running the modified program are given below:
8 8
amplitude
amplitude
6 6
4 4
2 2
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
Phase Spectrum of Original Seq Phase Spectrum of Time-Reversed Seq
4 4
2 2
amplitude
amplitude
0 0
-2 -2
-4 -4
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
From these plots we make the following observations both magnitude spectrum and phase spectrum is
reverted in frequency domain.
Q3.22 Program P3_6 was run for the following two different sets of sequences of varying lengths:
The plots generated by running the modified program are given below:
num = [5 7 3 4 1];
12
Magnitude Spectrum of Original Seq Magnitude Spectrum of Time-Reversed Seq
20 20
a m p litu d e
a m p litu d e
15 15
10 10
5 5
0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
Phase Spectrum of Original Seq Phase Spectrum of Time-Reversed Seq
4 4
a m p litu d e
a m p litu d e
2 2
0 0
-2 -2
-4 -4
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
am plitude
40 40
20 20
0 0
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
Phase Spectrum of Original Seq Phase Spectrum of Time-Reversed Seq
4 4
am plitude
am plitude
2 2
0 0
-2 -2
-4 -4
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
/ /
From these plots we make the following observations: the time-reversal property is not change
Answers:
Q3.23 The MATLAB program to compute and plot the L-point DFT X[k] of a length-N sequence x[n] with L N
and then to compute and plot the IDFT of X[k] is given below:
% Evaluation of the DFT
clf;
% Compute the frequency samples of the DFT
xn = [1 3 5 7 9 11 13 15 17 2];den = 1;
N=length(xn);
k=0:N-1;
w=2*pi*k/N;
Xn = freqz(xn, den, w);
%Plot the x[n])
subplot(3,1,1)
stem(k,xn);grid
title('x[n]')
xlabel('n');
ylabel('Amplitude');
% Plot the DFT
subplot(3,1,2)
13
stem(w,real(Xn));grid
title('Real part of X[n]')
xlabel('w');
ylabel('Amplitude');
subplot(3,1,3)
stem(w,imag(Xn));grid
title('Imaginary part of X[n]')
xlabel('w');
ylabel('Amplitude');
x[n]
Amplitude
20
10
0
0 1 2 3 4 5 6 7 8 9
n
Real part of X[n]
Amplitude
100
-100
0 1 2 3 4 5 6
w
Imaginary part of X[n]
Amplitude
50
-50
0 1 2 3 4 5 6
w
The DFT and the IDFT pairs generated by running the program for sequences of different lengths N and for
different values of the DFT length L are shown below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
Q3.24 The MATLAB program to compute the N-point DFT of two length-N real sequences using a single N-point
DFT and compare the result by computing directly the two N-point DFTs is given below:
< Insert program code here. Copy from m-file(s) and paste. >
The DFTs generated by running the program for sequences of different lengths N are shown below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
Q3.25 The MATLAB program to compute the 2N-point DFT of a length-2N real sequence using a single N-point
DFT and compare the result by computing directly the 2N-point DFT is shown below:
< Insert program code here. Copy from m-file(s) and paste. >
The DFTs generated by running the program for sequences of different lengths 2N are shown below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
14
Answers:
Q3.26 The purpose of the command rem in the function circshift is used to get remainder after division between
abs(M) and length(x).
Q3.27 The function circshift operates as follows: the first, we compare value between abs(M) and length(x). Then
we get remainder after division between abs(M) and length(x), then this value is allocated to M. And the
last, as the case maybe whether M is possitive or negative, x[n] is advanced or delayed, respectively.
Q3.28 The purpose of the operator ~= in the function circonv is used to compare the length betwwen x[1] and x[2].
Q3.29 The function circonv operates as follows: the first, we compare the length between x1 and x2, to continue, the
length of x1 must same the length of x2. Then, we get mirror x2. The last we tocombine circularly shifting x2,
for loop and sum function to compute as known expression about the circular convolution.
Q3.30 The modified Program P3_7 created by adding appropriate comment statements, and adding pro gram
statements for labeling each plot being generated by the program is given below:
% Illustration of Circular Shift of a Sequence
clf;
M = 6;
a = [0 1 2 3 4 5 6 7 8 9];
b = circshift(a,M);
L = length(a)-1;
n = 0:L;
subplot(2,1,1);
stem(n,a);axis([0,L,min(a),max(a)]);
title('Original Sequence');
xlabel('n');
ylabel('Amplitude');
subplot(2,1,2);
stem(n,b);axis([0,L,min(a),max(a)]);
title(['Sequence Obtained by Circularly Shifting by ',num2str(M),'
Samples']);
xlabel('n');
ylabel('Amplitude');
If the amount of time-shift is greater than the sequence length then the amount of time-shifting is modulus
after M divide the length of a sequence - a.
Q3.31 The plots generated by running the modified program are given below:
Original Sequence
6
Amplitude
0
0 1 2 3 4 5 6 7 8 9
n
Sequence Obtained by Circularly Shifting by 6 Samples
6
Amplitude
0
0 1 2 3 4 5 6 7 8 9
n
From these plots we make the following observations: with M>0, we have a new, which is delayed.
15
Q3.32 The modified Program P3_8 created by adding appropriate comment statements, and adding pro gram
statements for labeling each plot being generated by the program is given below:
% Circular Time-Shifting Property of DFT
clf;
x = [0 2 4 6 8 10 12 14 16];
N = length(x)-1; n = 0:N;
y = circshift(x,5);
XF = fft(x);
YF = fft(y);
subplot(2,2,1)
stem(n,abs(XF));grid
xlabel('n');
ylabel('Amplitude');
title('Magnitude of DFT of Original Seq');
subplot(2,2,2)
stem(n,abs(YF));grid
xlabel('n');
ylabel('Amplitude');
title('Magnitude of DFT of Circularly Shifted Seq');
subplot(2,2,3)
stem(n,angle(XF));grid
xlabel('n');
ylabel('Amplitude');
title('Phase of DFT of Original Seq');
subplot(2,2,4)
stem(n,angle(YF));grid
xlabel('n');
ylabel('Amplitude');
title('Phase of DFT of Circularly Shifted Seq');
Q3.33 The plots generated by running the modified program are given below:
Magnitude of DFT of Original Seq Magnitude of DFT of Circularly Shifted Seq
80 80
60 60
Amplitude
Amplitude
40 40
20 20
0 0
0 2 4 6 8 0 2 4 6 8
n n
Phase of DFT of Original Seq Phase of DFT of Circularly Shifted Seq
4 4
2 2
Amplitude
Amplitude
0 0
-2 -2
-4 -4
0 2 4 6 8 0 2 4 6 8
n n
From these plots we make the following observations: Circular Time-Shifting Property of DFT only change
about Phase.
Q3.34 The plots generated by running the modified program for the following two different amounts of time-shifts,
with the amount of shift indicated, are shown below:
16
The amount of time-shift is 10 sample
60 60
Amplitude
Amplitude
40 40
20 20
0 0
0 2 4 6 8 0 2 4 6 8
n n
Phase of DFT of Original Seq Phase of DFT of Circularly Shifted Seq
4 4
2 2
Amplitude
Amplitude
0 0
-2 -2
-4 -4
0 2 4 6 8 0 2 4 6 8
n n
60 60
Amplitude
Amplitude
40 40
20 20
0 0
0 2 4 6 8 0 2 4 6 8
n n
Phase of DFT of Original Seq Phase of DFT of Circularly Shifted Seq
4 4
2 2
Amplitude
Amplitude
0 0
-2 -2
-4 -4
0 2 4 6 8 0 2 4 6 8
n n
From these plots we make the following observations: The Circular Time-Shifting Property is certain.
Q3.35 The plots generated by running the modified program for the following two different sequences of different
lengths, with the lengths indicated, are shown below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
Q3.36 A copy of Program P3_9 is given below along with the plots generated by running this program:
17
% Program P3_9
% Circular Convolution Property of DFT
g1 = [1 2 3 4 5 6]; g2 = [1 -2 3 3 -2 1];
n=1:length(g1);
ycir = circonv(g1,g2);
disp('Result of circular convolution = ');disp(ycir)
subplot(2,1,1)
stem(n,ycir);grid
xlabel('n');
ylabel('Amplitude');
title('Result of circular convolution');
G1 = fft(g1); G2 = fft(g2);
yc = real(ifft(G1.*G2));
disp('Result of IDFT of the DFT products = ');disp(yc)
subplot(2,1,2)
stem(n,real(yc));
xlabel('n');
ylabel('Amplitude');
title('Result of IDFT of the DFT products');
20
10
0
1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
n
Result of IDFT of the DFT products
30
Amplitude
20
10
0
1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
n
From these plots we make the following observations: circular convolution and IDFT of the DFT products give
the same result.
Q3.37 Program P3_9 was run again for the following two different sets of equal-length sequences:
150
100
50
0
1 2 3 4 5 6 7 8 9 10
n
Result of IDFT of the DFT products
200
A m plitude
150
100
50
0
1 2 3 4 5 6 7 8 9 10
n
g1 = [1 2 3 4 5 6 7 8 9 10 7 4 6 2 5];
g2 = [1 -2 3 4 5 4 2 7 3 1 3 -2 1 0 5];
18
Result of circular convolution
250
200
Amplitude
150
100
50
0
0 5 10 15
n
Result of IDFT of the DFT products
300
200
Amplitude
100
0
0 5 10 15
n
From these plots we make the following observations: circular convolution and IDFT of the DFT products
give same result that is certain.
Q3.38 A copy of Program P3_10 is given below along with the plots generated by running this program:
% Linear Convolution via Circular Convolution
g1 = [1 2 3 4 5];g2 = [2 2 0 1 1];
g1e = [g1 zeros(1,length(g2)-1)];
g2e = [g2 zeros(1,length(g1)-1)];
n=0:length(g1e)-1;
ylin = circonv(g1e,g2e);
disp('Linear convolution via circular convolution = ');disp(ylin);
subplot(2,1,1)
stem(n,ylin);
xlabel('n');
ylabel('Amplitude');
title('Linear convolution via circular convolution');
y = conv(g1, g2);
disp('Direct linear convolution = ');disp(y)
subplot(2,1,2)
stem(n,y);
xlabel('n');
ylabel('Amplitude');
title('Direct linear convolution');
20
Amplitude
15
10
0
0 1 2 3 4 5 6 7 8
n
Direct linear convolution
30
Amplitude
20
10
0
0 1 2 3 4 5 6 7 8
n
19
From these plots we make the following observations: Linear convolution via circular convolution and Direct
linear convolution give the same result.
Q3.39 Program P3_10 was run again for the following two different sets of sequences of unequal lengths:
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
Q3.40 The MATLAB program to develop the linear convolution of two sequences via the DFT of each is given
below:
< Insert program code here. Copy from m-file(s) and paste. >
The plots generated by running this program for the sequences of Q3.38 are shown below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
The plots generated by running this program for the sequences of Q3.39 are shown below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
The relation between the sequence x1[n] and x[n] is mirror image each orther.
Q3.42 The plots generated by running Program P3_11 are given below:
20
Re(DFT{x[n]}) Im(DFT{x[n]})
100 100
50
50
Amplitude
Amplitude
0
0
-50
-50 -100
0 0.5 1 1.5 2 0 0.5 1 1.5 2
0.5
50
Amplitude
Amplitude
0
0
-0.5
-50
0 0.5 1 1.5 2 0 0.5 1 1.5 2
Time index n Time index n
The imaginary part of XEF is/is not equal to zero. This result can be explained as follows:
Q3.43 The required modifications to Program P3_11 to verify the relation between the DFT of the periodic odd part
and the imaginary part of XEF are given below along with the plots generated by running this program:
< Insert program code here. Copy from m-file(s) and paste. >
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
% Parseval's Relation
x = [(1:128) (128:-1:1)];
XF = fft(x);
a = sum(x.*x)
b = round(sum(abs(XF).^2)/256)
disp('a=');disp(a);
disp('b=');disp(b);
% Parseval's Relation
x = [(1:128) (128:-1:1)];
XF = fft(x);
a = sum(x.*x)
XFconj=conj(XF);
b=round(sum(XF.*XFconj)/256);
disp('a=');disp(a);
disp('b=');disp(b);
3.3 z-TRANSFORM
Answers:
Q3.46 The frequency response of the z-transform obtained using Program P3_1 is plotted below:
21
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 z-transform is given below:
num = [2 5 9 5 3];den = [5 45 2 1 1];
zplane(num, den);grid;
title('The pole-zero plot of a rational z-transform G(z)');
[z, p, k] = tf2zp(num,den);
sos=(zp2sos(z,p,k));
disp(sos);
Using this program we obtain the following results on the z-transform G(z) of Q3.46:
22
Sos= [0.4000 0.8000 1.2000 1.0000 9.2293 2.4344;
Q3.48 From the pole-zero plot generated in Question Q3.47, the number of regions of convergence (ROC) of G(z)
are |z|>max|pi|=8.9576
From the pole-zero plot it can be seen that the DTFT doesn’t exist because the ROC of G(z) doesn’t include
the unit circle.
Q3.49 The MATLAB program to compute and display the rational z-transform from its zeros, poles and gain
constant is given below:
r = [0.3; 2.5; -0.2+0.4i; -0.2-0.4i];
p = [0.5; -0.75; 0.6+0.7i; 0.6-0.7i];
k =3.9;
[num,den] = zp2tf(r,p,k);
disp('num='),disp(num);
disp('den='),disp(den);
The rational form of a z-transform with the given poles, zeros, and gain is found to be:
Answers:
23
stem(impz(num,den,L));
title(['The inverse transform with Samples with ',num2str(L),'
Samples'])
xlabel('Time ')
Q3.50 The MATLAB program to compute the first L samples of the inverse of a rational z-transform is given
below:
The plot of the first 50 samples of the inverse of G(z) of Q3.46 obtained using this program is sketched
below:
Q3.51 The MATLAB program to determine the partial-fraction expansion of a rational z-transform is given below:
num = [2 5 9 5 3]; den = [5 45 2 1 1];
[r,p,k]=residuez(num,den);
disp('r='),disp(r);
disp('p='),disp(p);
disp('k='),disp(k);
The partial-fraction expansion of G(z) of Q3.46 obtained using this program is shown below:
r=
0.3109
-1.0254 - 0.3547i
-1.0254 + 0.3547i
-0.8601
p=
-8.9576
0.1147 + 0.2627i
0.1147 - 0.2627i
-0.2718
k=
3.0000
From the above partial-fraction expansion we arrive at the inverse z-transform g[n] as shown below:
24
0.31 1.03 0.35i 1.03 0.35i 0.86
G( z) 1
2
3
3
1 ( 8.96) z 1 (0.11 0.26i ) z 1 (0.11 0.26i ) z 1 ( 0.27) z 4
25