Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

DTFT Computation - Project Report | ECE 5213, Assignments of Digital Signal Processing

Material Type: Assignment; Professor: Havlicek; Class: Digital Signal Processing; Subject: ELECTRICAL AND COMPUTER ENGINEERING; University: University of Oklahoma; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 08/31/2009

koofers-user-se9-1
koofers-user-se9-1 🇺🇸

10 documents

1 / 57

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Name: SOLUTION (Havlicek)
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
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 -
()
1
1
2
1 0.6
jz
He z
ω
+
=
The function of the pause command is - to pause execution of a Matlab program. Without
arguments, pause waits for the user to type any key. With an argument, pause pauses
for a number of seconds specified by the argument.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39

Partial preview of the text

Download DTFT Computation - Project Report | ECE 5213 and more Assignments Digital Signal Processing in PDF only on Docsity!

Name: SOLUTION (Havlicek)

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_

% Evaluation of the DTFT

clf;

% Compute the frequency samples of the DTFT

w = -4pi:8pi/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

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 -

1

1

j

z

H e

z

ω

The function of the pause command is - to pause execution of a Matlab program. Without

arguments, pause waits for the user to type any key. With an argument, pause pauses

for a number of seconds specified by the argument.

Q3.2 The plots generated by running Program P3_1 are shown below:

Real part of H(e

j ω

ω

π

Amplitude

Imaginary part of H(e

j ω

ω

π

Amplitude

Magnitude Spectrum |H(e

j ω

ω

π

Amplitude

Phase Spectrum arg[H(e

)]

ω

π

Phase in radians

The plots generated by running the modified Program P3_1 are shown below:

Real part of H(e

j ω

ω

π

Amplitude

Imaginary part of H(e

j ω

ω

π

Amplitude

Magnitude Spectrum |H(e

j ω

ω

π

Amplitude

Phase Spectrum arg[H(e

)]

ω

π

Phase in radians

The DTFT is a periodic_ function of ω.

Its period is - 2π

The jump in the phase spectrum is caused by - a branch cut in the arctan function used by

angle in computing the phase. “angle” returns the principal branch of arctan.

The phase spectrum evaluated with the jump removed by the command unwrap is as given

below:

Phase Spectrum arg[H(e

j ω

)]

ω

π

Phase in radians

Q3.4 The required modifications to Program P3_1 to evaluate the given DTFT of Q3.4 are given below:

% Program P3_1D

% Evaluation of the DTFT

clf;

% Compute the frequency samples of the DTFT

w = -4pi:8pi/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

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

Magnitude Spectrum |H(e

j ω

ω

π

Amplitude

Phase Spectrum arg[H(e

j ω

)]

ω

π

Phase in radians

The DTFT is a periodic function of ω.

Its period is - 2π

The jump in the phase spectrum is caused by - “angle” returns the principal value of the

arc tangent.

Q3.5 The required modifications to Program P3_1 to plot the phase in degrees are indicated below:

Only the last paragraph of the code needs to be changed to:

% plot phase in degrees

subplot(2,1,2)

plot(w/pi,180*angle(h)/pi);grid

title('Phase Spectrum arg[H(e^{j\omega})]')

xlabel('\omega /\pi');

ylabel('Phase in degrees');

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_2B

% Time-Shifting Properties of DTFT

clf;

w = -pi:2*pi/255:pi; % freqency vector for evaluating DTFT

D = 10; % Amount of time shift in samples

num = [1 2 3 4 5 6 7 8 9];

% h1 is the DTFT of original sequence

% h2 is the DTFT of the time shifted sequence

h1 = freqz(num, 1, w);

h2 = freqz([zeros(1,D) num], 1, w);

subplot(2,2,1)

% plot the DTFT magnitude of the original sequence

plot(w/pi,abs(h1));grid

title('Magnitude Spectrum of Original Sequence','FontSize',8)

xlabel('\omega /\pi');

ylabel('Amplitude');

% plot the DTFT magnitude of the shifted sequence

subplot(2,2,2)

plot(w/pi,abs(h2));grid

title('Magnitude Spectrum of Time-Shifted Sequence','FontSize',8)

xlabel('\omega /\pi');

ylabel('Amplitude');

% plot the DTFT phase of the original sequence

subplot(2,2,3)

plot(w/pi,angle(h1));grid

title('Phase Spectrum of Original Sequence','FontSize',8)

xlabel('\omega /\pi');

ylabel('Phase in radians');

% plot the DTFT phase of the shifted sequence

subplot(2,2,4)

plot(w/pi,angle(h2));grid

title('Phase Spectrum of Time-Shifted Sequence','FontSize',8)

xlabel('\omega /\pi');

ylabel('Phase in radians');

The parameter controlling the amount of time-shift is - D

Magnitude Spectrum of Original Sequence

ω

π

Amplitude

Magnitude Spectrum of Time-Shifted Sequence

ω

π

Amplitude

Phase Spectrum of Original Sequence

ω

π

Phase in radians

Phase Spectrum of Time-Shifted Sequence

ω

π

Phase in radians

From these plots we make the following observations: As before, of course, the time shift

has no effect on the magnitude spectrum. However, there is a very significant change

to the phase. As before, the time shift adds phase to the DTFT, making the slope of the

phase spectrum steeper. However, in this case with D=5 instead of D=10, the

(negative) increase in the slope is less than it was before.

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 –

  1. Length 4, time shift D=3.
  2. Length 16, time shift D=12.

The plots generated by running the modified program are given below:

Magnitude Spectrum of Original Sequence

ω

π

Amplitude

Magnitude Spectrum of Time-Shifted Sequence

ω

π

Amplitude

Phase Spectrum of Original Sequence

ω

π

Phase in radians

Phase Spectrum of Time-Shifted Sequence

ω

π

Phase in radians

Magnitude Spectrum of Original Sequence

ω

π

Amplitude

Magnitude Spectrum of Time-Shifted Sequence

ω

π

Amplitude

Phase Spectrum of Original Sequence

ω

π

Phase in radians

Phase Spectrum of Time-Shifted Sequence

ω

π

Phase in radians

From these plots we make the following observations: Increasing the length makes the

magnitude spectrum more narrow (i.e., makes the signal more “low pass”). It also

makes the phase steeper (i.e., the slope more negative). This is because, if we think of

the sequence as the impulse response of an LTI system, increasing the length adds more

Magnitude Spectrum of Original Sequence

ω

π

Amplitude

Magnitude Spectrum of Frequency-Shifted Sequence

ω

π

Amplitude

Phase Spectrum of Original Sequence

ω

π

Phase in radians

Phase Spectrum of Frequency-Shifted Sequence

ω

π

Phase in radians

From these plots we make the following observations: Both the magnitude and phase

spectra are shifted right by wo, which is given by 0.4π in this case. Note that the

frequency shifted signal was obtained by multiplying the original sequence pointwise

with a complex-valued exponential sequence. Thus, the frequency shifted sequence is

also complex-valued and it’s DTFT does not have conjugate symmetry.

Q3.12 Program P3_3 was run for the following value of the frequency-shift – wo = -0.5π.

The plots generated by running the modified program are given below:

Magnitude Spectrum of Original Sequence

ω

π

Amplitude

Magnitude Spectrum of Frequency-Shifted Sequence

ω

π

Amplitude

Phase Spectrum of Original Sequence

ω

π

Phase in radians

Phase Spectrum of Frequency-Shifted Sequence

ω

π

Phase in radians

From these plots we make the following observations: In this case, the magnitude and

phase spectra are shifted left by π/2 rad. As before, the frequency shifted signal is

complex-valued, so the frequency shift causes a loss of the conjugate symmetry that

was present in the spectrum of the original signal. NOTE: you should keep in mind

that these spectra are all 2π-periodic; we are only displaying the fundamental period.

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 –

  1. Length 4, frequency shift wo = π.
  2. Length 16, frequency shift wo = -0.3π.

The plots generated by running the modified program are given below:

the impulse responses of LTI systems, then a shorter length implies a smaller delay

between the input and output of the system, which corresponds to a phase spectrum

with a negative slope that is less steep. Likewise, a longer length implies a longer

delay between the input and output, which corresponds to a phase spectrum with a

negative slope that is steeper. In both cases shown here, the effect of the frequency

shift is to translate both the magnitude and phase spectrum by wo radians. Whereas the

original sequences are real-valued and hence have conjugate symmetric spectra, the

frequency shifted sequences are complex-valued and do not exhibit any inherent

spectral symmetry.

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_4B

% Convolution Property of DTFT

clf;

w = -pi:2*pi/255:pi; % freqency vector for evaluating DTFT

x1 = [1 3 5 7 9 11 13 15 17]; % first sequence

x2 = [1 -2 3 -2 1]; % second sequence

y = conv(x1,x2); % time domain convolution of x1 and x

h1 = freqz(x1, 1, w); % DTFT of sequence x

h2 = freqz(x2, 1, w); % DTFT of sequence x

% hp is the pointwise product of the two DTFT's

hp = h1.*h2;

% h3 is the DTFT of the time domain convolution;

% it should be the same as hp

h3 = freqz(y,1,w);

% plot the magnitude of the product of the two original spectra

subplot(2,2,1)

plot(w/pi,abs(hp));grid

title('Product of Magnitude Spectra','FontSize',8)

xlabel('\omega /\pi');

ylabel('Amplitude');

% plot the magnitude spectrum of the time domain convolution

subplot(2,2,2)

plot(w/pi,abs(h3));grid

title('Magnitude Spectrum of Convolved Sequence','FontSize',8)

xlabel('\omega /\pi');

ylabel('Amplitude');

% plot the phase of the product of the two original spectra

subplot(2,2,3)

plot(w/pi,angle(hp));grid

title('Sum of Phase Spectra','FontSize',8)

xlabel('\omega /\pi');

ylabel('Phase in radians');

% plot the phase spectrum of the time domain convolution

subplot(2,2,4)

plot(w/pi,angle(h3));grid

title('Phase Spectrum of Convolved Sequence','FontSize',8)

xlabel('\omega /\pi');

ylabel('Phase in radians');

Q3.15 The plots generated by running the modified program are given below:

Product of Magnitude Spectra

ω

π

Amplitude

Magnitude Spectrum of Convolved Sequence

ω

π

Amplitude

Sum of Phase Spectra

ω

π

Phase in radians

Phase Spectrum of Convolved Sequence

ω

π

Phase in radians

From these plots we make the following observations: The DTFT magnitude and phase

spectra obtained by performing pointwise multiplication of the two DTFT’s of the

original sequences are identical to those obtained by performing time domain

convolution of the two original sequences; this verifies the convolution property of the

DTFT.

Q3.16 Program P3_4 was run for the following two different sets of sequences of varying lengths –

  1. Length of x1 = 8; x1[n] = ( )

1 2

n

for 0 ≤ n ≤ 7;

Length of x2 = 4; x2[n]= [0.25 0.25 0.25 0.25]

  1. Length of x1 = 16; x1[n] = ( )

3 4

n

− for 0 ≤ n ≤ 15;

Length of x2 = 8; x2[n]= [1 3 5 7 9 11 13 15]

The plots generated by running the modified program are given below:

are identical to the magnitude and phase spectra obtained from the DTFT of the time

domain convolution of the two original sequences.

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_5B

% Modulation Property of DTFT

clf;

w = -pi:2*pi/255:pi; % freqency vector for evaluating DTFT

x1 = [1 3 5 7 9 11 13 15 17]; % first sequence

x2 = [1 -1 1 -1 1 -1 1 -1 1]; % second sequence

% y is the time domain pointwise product of x1 and x

y = x1.*x2;

h1 = freqz(x1, 1, w); % DTFT of sequence x

h2 = freqz(x2, 1, w); % DTFT of sequence x

h3 = freqz(y,1,w); % DTFT of sequence y

% plot the magnitude spectrum of x

subplot(3,1,1)

plot(w/pi,abs(h1));grid

title('Magnitude Spectrum of First Sequence')

xlabel('\omega /\pi');

ylabel('Amplitude');

% plot the magnitude spectrum of x

subplot(3,1,2)

plot(w/pi,abs(h2));grid

title('Magnitude Spectrum of Second Sequence')

xlabel('\omega /\pi');

ylabel('Amplitude');

% plot the magnitude spectrum of y

% it should be 1/2pi times the convolution of the DTFT's

% of the two original sequences.

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:

Magnitude Spectrum of First Sequence

ω

π

Amplitude

Magnitude Spectrum of Second Sequence

ω

π

Amplitude

Magnitude Spectrum of Product Sequence

ω

π

Amplitude

From these plots we make the following observations: The DTFT of the product sequence

y is 1/2π times the convolution of the DTFT’s of the two sequences x1 and x2, as

expected. The low-pass mainlobe of the DTFT of x1 combines with the high-pass

mainlobe of the DTFT of x2 to produce a high-pass mainlobe centered at ±π in the

magnitude spectrum of the product signal. The low-pass mainlobe of the DTFT of x

combines with the low-pass sidelobes of the DTFT of x2 to produce a low-pass smooth

region of relatively lower gain centered at DC in the magnitude spectrum of the product

signal.

Q3.19 Program P3_5 was run for the following two different sets of sequences of varying lengths –

  1. Length of x1 = 8; x1[n] = ( )

1 2

n

for 0 ≤ n ≤ 7;

Length of x2 = 8; x2[n]= [1/8 1/8 1/8 1/8 1/8 1/8 1/8 1/8]

  1. Length of x1 = 16; x1[n] = ( )

3 4

n

− for 0 ≤ n ≤ 15;

Length of x2 = 16; x2[n]= [1 3 5 7 9 11 13 15 0 0 0 0 0 0 0 0]

The plots generated by running the modified program are given below: