Laboratory Exercise 3: Discrete-Time Signals: Frequency-Domain Representations

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 18

Name:

Section:

Laboratory Exercise 3
DISCRETE-TIME SIGNALS: FREQUENCY-DOMAIN
REPRESENTATIONS

3.1 DISCRETE-TIME FOURIER TRANSFORM

Project 3.1 DTFT Computation

A copy of Program P3_1 is given 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)
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:

Q3.1 The expression of the DTFT being evaluated in Program P3_1 is -

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

The DTFT is a ___ tuần hoàn liên tục________ function of .

Its period is - chu kì 2pi

The types of symmetries exhibited by the four plots are as follows :

Hình 1,2: đồ thị chẵn

Hình 3,4: đồ thị lẻ

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 .

Its period is - chu kì 2pi

The jump in the phase spectrum is caused by -

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 .

Its period is - chu kì 2pi

The jump in the phase spectrum is caused by -

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

Project 3.2 DTFT Properties

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:

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

Phase Spectrum of Original Sequence


Phase Spectrum of Time-Shifted Sequence
4 4

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

Phase Spectrum of Original Sequence


Phase Spectrum of Time-Shifted Sequence
4 4

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

Phase Spectrum of Original Sequence


Phase Spectrum of Time-Shifted Sequence
4 4

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')

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

Phase Spectrum of Original Sequence


Phase Spectrum of Time-Shifted Sequence
4 4

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

Phase Spectrum of Original Sequence


Phase Spectrum of Time-Shifted Sequence
4 4

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:

Product of Magnitude Spectra


Magnitude Spectrum of Convolved Sequence
100 100

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

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')

Product of Magnitude Spectra


Magnitude Spectrum of Convolved Sequence
600 600

400 400

200 200

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

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')

Product of Magnitude Spectra


Magnitude Spectrum of Convolved Sequence
1000 1000

500 500

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

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.17 calculates the 5 point DFT of the sequence

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

Q3.18 calculates the 20 point DFT of the sequence


clf;
N=20;
n=0:19;
x=[ones(1,5) zeros(1,15)];
k=n;
xk=fft(x,N);
subplot(2,1,1);

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

You might also like