DSP Lab Spring 23 Exp-04
DSP Lab Spring 23 Exp-04
(EL-3031)
LABORATORY MANUAL
____________________________________________________________________________________________________________________________________________________________
Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
Lab # 04: Discrete Time Fourir Transform
Learning Objectives
To study various properties of discrete time Fourier transform and verify these properties on
various signals in Matlab.
Equipment Required
1. PC
2. MATLAB
1. Introduction
If x [n] is absolutely summable, that is
∞
∑|x [ n ]|< ∞
−∞
Then it’s discrete-time Fourier transform is given by
∞
X ( e jw )= ∑ x [ n ] e− jwn
n=−∞
π
1
x [n]= ∫ X ( e jw ) e jwn dw
2 π −π
function of ω. Since the data in MATLAB is in vector form, X (e jw ) can only be evaluated
at a prescribed set of discrete frequencies. Moreover, only a class of the DTFT that is
can be evaluated.
2. DTFT Computation
The DTFT X ( e jw )of a sequence x [n]of the form of Eq. (1) can be computed easily
at a prescribed set of L discrete frequency points ω=ω l using the MATLAB function
freqz. Since X (e jw ) is a continuous function of ω, it is necessary to make L as large as
possible so that the plot generated using the command plot provides a reasonable replica
of the actual plot of the DTFT. In MATLAB, freqz computes the L-point DFT of the
_____________________________________________________________________________________________
Page 2 of 7
DSP - Lab National University Roll No: __________
04
Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
sequences { p0 p 1 ... pM } and {d 0 d 1 ... d M } ,and then forms their ratio to arrive at X (e jwl )
l=1 , 2 , … … … … , L .For faster computation, L should be chosen as a power of 2, such as 256
or 512.
Task 01
1) Evaluate the DTFT of follwing in the range 0 ≤ w ≤ π (512 points)
− jw −2 jw −3 jw
0.7−0.5 e + 0.3 e +e
U ( e )=
jw
− jw −2 jw −3 jw
1+0.3 e −0.5 e +0.7 e
2) Compute and Plot the magnitude response, phase response, real part and imaginary part
w
of U ( e jw ) w.r.t. . Label your plots properly.
π
Hint : Commands used; “freqz”, “angle” ,”abs” , “imag”, “real”
Task 02
Is the DTFT a periodic function of ω? If it is, what is the period?
Project 4.1
% 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');
figure;
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, radians');
Task 03:
1) What is the expression of the DTFT being evaluated in the above Program and on what
range this DTFT is computed in the program?
_____________________________________________________________________________________________
Page 3 of 7
DSP - Lab National University Roll No: __________
04
Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
2) Comment on your results. Can you explain the jump in the phase spectrum ? The jump
can be removed using the MATLAB command “unwrap”. Evaluate the phase
spectrum with the jump removed.
3) Is the DTFT a periodic function of ω? If it is, what is the period?
Task 04:
1) Write matlab Program to evaluate and plot the magnitude and phase response of DTFT
of the following finite-length sequence in the range 0 ≤ w ≤ π (512 points)
DTFT Properties:
The DTFT satisfies a number of useful properties that are often uitilized in a number
of applications. A detailed listing of these properties and their analytical proofs can be
found in any text on digital signal processing. These properties can also be verified using
MATLAB. We list below a few selected properties that will be encountered later in this
exercise.
Time-Shifting Property – If G( e jω )denotes the DTFT of a sequence g[n] , then the DTFT
Convolution Property – If G(e jω )and H (e jω )denote the DTFTs of the sequences g[n] and
Time-Reversal Property – If G(e jω ) denotes the DTFT of a sequence g[n], then the DTFT
Task 05:
1) Write matlab Program to evaluate and plot the magnitude and phase response of DTFT
of the following finite-length sequence in the range −π ≤ w ≤ π (256 points)
g [ n ] =[1 2 3 4 5 6 7 8 9]
_____________________________________________________________________________________________
Page 4 of 7
DSP - Lab National University Roll No: __________
04
Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
2) Verify the time shifting property of of DTFT using n 0=10. Plot the magnitude and
phase response of the DTFT of time shifted sequence and then also plot the magnitude
and phase spectrum of e− jωn G ( e jω ) .
0
3) Verify the frequency shifting property of of DTFT using w 0=0.5 π . Plot the magnitude
and phase response of the DTFT of frequency shifted sequence and then also plot the
magnitude and phase spectrum of G ( e j (ω−ω ) ). 0
Task 06:
1) Write matlab Program to evaluate and plot the magnitude and phase response of DTFT
of the following finite-length sequences in the range −π ≤ w ≤ π (256 points)
_____________________________________________________________________________________________
Page 5 of 7
DSP - Lab National University Roll No: __________
04
Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
Student's feedback: Purpose of feedback is to know the strengths and weaknesses of the system
for future improvements. This feedback is for the 'current lab session'. Circle your choice:
[-3 = Extremely Poor, -2 = Very Poor, -1 = Poor, 0 = Average, 1 = Good, 2 = Very Good, 3 = Excellent]:
The following table should describe your experience with:
S# Field Rating Describe in words if required
1 Overall Session -
-2 -1 0 1 2 3
3
2 Lab Instructor -
-2 -1 0 1 2 3
3
3 Lab Staff -
-2 -1 0 1 2 3
3
4 Equipment -
-2 -1 0 1 2 3
3
5 Atmosphere -
-2 -1 0 1 2 3
3
Correctness
Conclusion
Originality
of results
Initiative
Neatness
MARKS
Attitude
TOTAL
TOTAL 10 10 10 20 20 30 100
EARNED
_____________________________________________________________________________________________
Page 6 of 7
DSP - Lab National University Roll No: __________
04
Lab #
of Computer and Emerging Sciences
(EL3031) Islamabad Spring 2023
_____________________________________________________________________________________
Lab Instructor's Comments:________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Assessment Rubric
LLO Statement Assessment Exemplary Proficient Developing Beginning Worst
Method (20%) (20%) (20%) (20%) Performance
(20%)
1 Analysis of Practical Skill Able to attempt Able to attempt Able to attempt Able to attempt Able to attempt
discrete-time Observation complete lab with 80% of the lab 60% of the lab 40% of the lab 20% of the lab
signals and during proper tasks tasks tasks tasks
verifying their experimentati labeling/explanatio
properties i.e. on & Lab n of results and
Discrete Fourier Reports proper commenting
Transform of the code
(DFT), Discrete
Time Fourier
Transform
(DTFT) using
MATLAB.
_____________________________________________________________________________________________
Page 7 of 7