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
Section:
Laboratory Exercise 3
DISCRETE-TIME SIGNALS: FREQUENCY-DOMAIN
REPRESENTATIONS
subplot(2,1,2)
plot(w/pi,imag(h));grid
pause
subplot(2,1,1)
plot(w/pi,abs(h));grid
subplot(2,1,2)
plot(w/pi,angle(h));grid
Answers:
pause command is – tạm dừng thực hiện chương trình cho đến khi dùng
The function of the
phím bất kì để thực hiện chương trình khác.
Q3.2 The plots generated by running Program P3_1 are shown below :
1
8 8
6 6
4 4
2 2
0 0
-4 -3 -2 -1 0 1 2 3 4 -4 -3 -2 -1 0 1 2 3 4
4 2
2 1
0 0
-2 -1
-4 -2
-4 -3 -2 -1 0 1 2 3 4 -4 -3 -2 -1 0 1 2 3 4
Q3.3 The required modifications to Program P3_1 to evaluate the given DTFT of Q3.3 are given below :
% Program P3_1
% Evaluation of the DTFT
clf;
% Compute the frequency samples of the DTFT
w = 0*pi:8*pi/511:1*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,1,1)
plot(w/pi,real(h));grid
subplot(2,1,2)
plot(w/pi,imag(h));grid
pause
subplot(2,1,1)
plot(w/pi,abs(h));grid
subplot(2,1,2)
plot(w/pi,angle(h));grid
The plots generated by running the modified Program P3_1 are shown below :
2
1
0.5
-0.5
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0.5
-0.5
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1.0000000000002
1.0000000000001
0.9999999999999
0.9999999999998
0 0.2 0.4 0.6 0.8 1
-2
-4
0 0.2 0.4 0.6 0.8 1
3
The DTFT is a __hàm liên tục tuần hoàn theo biến _ ω ________ function of .
The phase spectrum evaluated with the jump removed by the command unwrap is as given below:
< Insert MATLAB figure(s) here. Copy from figure window(s) and paste. >
Q3.4 The required modifications to Program P3_1 to evaluate the given DTFT of Q3.4 are given below :
DDĐ
The plots generated by running the modified Program P3_1 are shown below :
% 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 3 5 7 9 11 13 15 17];den = [1];
h = freqz(num, den, w);
% Plot the DTFT
subplot(2,1,1)
plot(w/pi,real(h));grid
subplot(2,1,2)
plot(w/pi,imag(h));grid
pause
subplot(2,1,1)
plot(w/pi,abs(h));grid
subplot(2,1,2)
plot(w/pi,angle(h));grid
4
5
The DTFT is a ______hàm liên tục tuần hoàn theo biến ω _____ function of .
Q3.5 The required modifications to Program P3_1 to plot the phase in degrees are indicated below :
% Program P3_1
% 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
subplot(2,1,2)
6
plot(w/pi,imag(h));grid
pause
subplot(2,1,1)
plot(w/pi,abs(h));grid
subplot(2,1,2)
plot(w/pi,(angle(h).*180)/pi);grid
0
-4 -3 -2 -1 0 1 2 3 4
-2
-4
-4 -3 -2 -1 0 1 2 3 4
7
8
0
-4 -3 -2 -1 0 1 2 3 4
100
50
-50
-100
-4 -3 -2 -1 0 1 2 3 4
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
% 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')
8
The parameter controlling the amount of time-shift is -D
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 :Sự dịch thời gian này không ảnh
hưởng lên phổ biên độ, chỉ ảnh hưởng đến phổ pha.
Q3.8 Program P3_2 was run for the following value of the time-shift – D=15
The plots generated by running the modified program are given below:
9
Magnitude Spectrum of Original Magnitude
Sequence 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
D=20
10
Magnitude Spectrum of Original Magnitude
Sequence 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
From these plots we make the following observations : Sự dịch thời gian này không ảnh hưởng
lên phổ biên độ, chỉ ảnh hưởng đến phổ pha.
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 -
The plots generated by running the modified program are given below:
% Program P3_2
% Time-Shifting Properties of DTFT
clf;
w = -pi:2*pi/255:pi; wo = 0.4*pi; D = 20;
num = [1 2 3 4 5 6 7 8 9 3 4 5];
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
11
title('Phase Spectrum of Time-Shifted Sequence')
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
% Program P3_2
% Time-Shifting Properties of DTFT
clf;
w = -pi:2*pi/255:pi; wo = 0.4*pi; D = 15;
num = [1 2 3 4 5 6 7 8 9 3 8 5 4];
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')
12
Magnitude Spectrum of Original Magnitude
Sequence Spectrum of Time-Shifted Sequence
80 80
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
From these plots we make the following observations : Sự dịch thời gian này không ảnh hưởng
lên phổ biên độ, chỉ ảnh hưởng đến phổ pha.
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);
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')
subplot(2,2,2)
plot(w/pi,abs(h3));grid
13
title('Magnitude Spectrum of Convolved Sequence')
subplot(2,2,3)
plot(w/pi,angle(hp));grid
title('Sum of Phase Spectra')
subplot(2,2,4)
plot(w/pi,angle(h3));grid
title('Phase Spectrum of Convolved Sequence')
Q3.15 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
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 : phổ biên độ, phổ pha cả 2 trường hợp
giống nhau
Q3.16 Program P3_4 was run for the following two different sets of sequences of varying lengths -
The plots generated by running the modified program are 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 19];
14
x2 = [1 -2 3 -2 1 5];
y = conv(x1,x2);
h1 = freqz(x1, 1, w);
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')
subplot(2,2,2)
plot(w/pi,abs(h3));grid
title('Magnitude Spectrum of Convolved Sequence')
subplot(2,2,3)
plot(w/pi,angle(hp));grid
title('Sum of Phase Spectra')
subplot(2,2,4)
plot(w/pi,angle(h3));grid
title('Phase Spectrum of Convolved Sequence')
400 400
200 200
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
% Program P3_4
% Convolution Property of DTFT
clf;
w = -pi:2*pi/255:pi;
x1 = [1 3 5 7 9 11 13 15 17 14];
x2 = [1 -2 3 -2 1 8];
y = conv(x1,x2);
h1 = freqz(x1, 1, w);
15
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')
subplot(2,2,2)
plot(w/pi,abs(h3));grid
title('Magnitude Spectrum of Convolved Sequence')
subplot(2,2,3)
plot(w/pi,angle(hp));grid
title('Sum of Phase Spectra')
subplot(2,2,4)
plot(w/pi,angle(h3));grid
title('Phase Spectrum of Convolved Sequence')
500 500
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 : phổ biên độ, phổ pha cả 2 trường hợp giống nhau
16
X(n)= {1,1,0,0,1}
N=5;
n=0:N-1;
x=[1 1 0 0 1];
K=n;
xK=fft(x,N);
subplot(2,1,1)
stem(n,x)
subplot(2,1,2)
stem(K,abs(xK))
0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4
0
0 0.5 1 1.5 2 2.5 3 3.5 4
17
stem(n,x);
subplot(2,1,2);
stem(k,abs(xk));
0.5
0
0 2 4 6 8 10 12 14 16 18 20
0
0 2 4 6 8 10 12 14 16 18 20
18