0% found this document useful (0 votes)
11 views10 pages

DSP Lab 7

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views10 pages

DSP Lab 7

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Group Members:

Syed Muhammad Noor Ali Shah 2021-CE-36


Aneeq Imran 2021-CE-38,
Muhammad Ahmed 2021-CE-43

Date: 04/25/2024
Grade and Signature given by instructor:
Digital Signal Processing (Lab 7)
Experiment 6: Discrete Time Fourier Transform (DTFT) using MATLAB
Course Name: Digital signal processing Course Code: CMPE-371L
Assignment Type: Assignment/Lab/Project Dated:
Semester:6TH Session:2020
Lab/Project/Assignment #: 7 CLOs to be covered:
Lab Title: Discrete Time Fourier Series (DTFT) using Teacher Name: Ms. Sana Tasleem
MATLAB

Lab Evaluation:
CLO1 Students will be able to perform signal processing tasks and display
their results, using a DSP board or a modern software tool such as
MATLAB.
Levels (Marks) Level1 Level2 Level3 Level4 Level5 Level6
Psychomotor (8)
Total /10
CLO2 Students will be able to report in written form what they have learnt in
the lab after discussions with their peers.
Level1 Level2 Level3 Level4 Level5 Level6
Affective (3)
Dressing (2)
Total /5

Rubrics for Current Lab (Optional):

Scale Marks Level Rubric


Excellent 5 L1 Execute all the codes with proper explanation with graphical view if
required.
Very Good 4 L2 Execute all codes and create an understanding level.

Good 3 L3 Locally executed codes and try to fill lab report.


Basic 2 L4 Locally executed shared in this lab using MATLAB.
Barely 1 L5 Tried to run code but could not do so. Effort can be tracked.
Acceptabl
e
Not 0 L6 Did not attempt
Acceptabl
e

LAB DETAILS:
Lab Goals/Objectives:
 Generate the basic Matlab graph.
 Create the histogram in Matlab .
 Improve performance to create different types of signals and their analysis.

Problem 1
1. Write a MATLAB function to compute the DTFT of a finite duration sequence. The
function will compute 101 samples (from −π to π) of the DTFT of a discrete time signal. The
format of the function should be

function [X] = DTFT(x, n_i)


% Computes 101 samples (from −π to π) of the DTFT of a
discrete time signal x
% x = finite duration discrete time signal
% n_i = starting index of x
% X = 101 values of the DTFT of x

2. Use your function to compute the DTFT of the following


signal x[n] = cos(0.5πn) + j sin(0.5πn)(u[n] − u[n −
51]].
3. Use your function to compute the DTFT of the following conjugate antisymmetric
signal x[n] = {−1, −2, −3, −4, 0, 4, 3, 2, 1,} Starting index = −4
Notice that x[n] is also odd. Using the appropriate symmetry property of the DTFT
explain why is the DTFT of x[n] purely imaginary.

Similarly, if a signal is odd and real, then its DTFT is odd and purely imaginary. This follows
from Hermitian symmetry for real signals, and the fact that the DTFT of any odd signal is
imaginary. Since signal is odd than dtft is purely imaginary
This code first defines the signal x[n] using the given expression, and then computes the DTFT of
x[n] using the DTFT function we created earlier. Finally, it plots the magnitude and phase of
X(w) over the range from -pi to pi.
The resulting plot shows that the DTFT of x[n] is a periodic function with a period of 2*pi/51.
The magnitude of the DTFT is constant at 1 for all frequencies, indicating that the signal is a pure
tone. The phase of the DTFT varies linearly with frequency, indicating that the signal is a linearly
frequency-modulated (LFM) signal
4. Plot the spectrum of x[n] in MATLAB using the DTFT which you have computed, as
the angular frequency varies from −5π to 5π.

The plot shows that the DTFT of x[n] is purely imaginary, with zero magnitude at all frequencies. This can
be explained by the conjugate antisymmetry property of the DTFT, which states that the DTFT of a
conjugate antisymmetric signal is purely imaginary. This property can be expressed mathematically as
follows:
If x[n] is a conjugate antisymmetric sequence,
i.e., x[-n] = conj(x[n]), then X(e^(jw)) = -jIm{X(e^(jw))}
Since x[n] is a real sequence, it follows that x[-n] = conj(x[n]) implies that x[n] is an odd function of n.
Therefore, we can use the fact that the DTFT of an odd function is purely imaginary to conclude that the
DTFT of x[n] is also purely imaginary. This is consistent with the plot above.

Problem 2
Let x1[n] = {1, 2, 2, 1} Starting index = 0
A new sequence x2[n] is formed using such that x2[n] = x1[n−1] + x1[n+4]. Notice
that x2[n] is conjugate symmetric and is also even.

1 Express X2(ejω) in terms of X1(ejω) without explicitly computing X1(ejω).

Since x2[n] is conjugate symmetric and even, its DTFT X2(e^jω) can be expressed as:

X2(e^jω) = 2Re{X2(e^jω)} = 2Re{X2(e^jω)} + 2Re{X2(e^-jω)}

where Re{•} denotes the real part. Now, using the time-shifting property of the DTFT, we
have:

X2(e^jω) = e^-jω X1(e^jω) + e^4jω X1(e^jω)

Therefore, we can express X2(e^jω) in terms of X1(e^jω) as:

X2(e^jω) = (e^-jω + e^4jω) X1(e^jω)

2 Show that X2(ejω) is purely real.


Conjugation and Conjugate Symmetry Property
x∗[n] ←→ X∗(e^−jω) (1)
Thus, if x is real-valued, then:
X(e^jω) = X∗(e^−jω) (2)
To show that X2(e^jω) is purely real, we need to show that X2(e^jω) = X2*(e^-jω), where *
denotes the complex conjugate.
Let's start by taking the complex conjugate of the expression we found for X2(e^jω):
X2*(e^-jω) = [(e^-jω + e^4jω) X1(e^-jω)]*
Using the properties of complex conjugation, we have:
(e^-jω + e^4jω)* = e^jω + e^-4jω
and
X1*(e^-jω) = X1(e^jω)
Substituting these into the expression for X2*(e^-jω), we get:
X2*(e^-jω) = (e^jω + e^-4jω) X1(e^jω)
Now we can see that:
X2*(e^-jω) = X2(e^jω)
Therefore, X2(e^jω) is conjugate symmetric and hence purely real.

3 Using the appropriate symmetry property of the DTFT explain why is the DTFT of
x[n] purely imaginary.

If a signal is even in addition to being real, then its DTFT is also real and even. This follows
immediately from the Hermitian symmetry of real signals, and the fact that the DTFT of any
even signal is real.

Similarly, if a signal is odd and real, then its DTFT is odd and purely imaginary. This follows
from Hermitian symmetry for real signals, and the fact that the DTFT of any odd signal is
imaginary.

In question wasn’t defined that we have to work for x1[n] or x2[n]. But for both signal the
DTFT is even and real not imaginary as both signal are even and real.

4 Verify your result using MATLAB by computing and plotting magnitudes of the respective
DTFTs.

x1(n - 1), 1 ≤ n ≤ 4;

x2(n) = x1(n + 4), - 4 ≤ n ≤ -1;

0, Otherwise.
Problem 3
1 Write a MATLAB function to compute the inverse DTFT of a finite duration sequence.
The function will compute the discrete time signal using 101 samples (from −π to π) of its
DTFT. The format of the function should be

function [x, n_i] = IDTFT(X)


% Computes the discrete time signal x using 101 samples
(from −π to π) of its DTFT
% x = finite duration discrete time signal
% n_i = starting index of x
% X = 101 values of the DTFT of x
2 Use your function to compute the IDTFT of the DTFT computed in Problem 1 part 3.
Do you get the same signal x[n] back? i.e.
x[n] = {−1, −2, −3, −4, 5, 4, 3, 2, 1,} Starting index = −4
3 Use your function to compute the IDTFT of the DTFT computed in Problem 2. Do you
get the same signal x2[n] back? i.e.
x2[n] = {1, 2, 2, 1, 0, 1, 2, 2, 1} Starting index = −4
Lab Summary
Summarize in your own words within one page what you learnt in this lab.
In the first problem we simply defined the DTFT of a finite-duration sequence which is a periodic function
in the frequency domain with a period of 2π. It is defined by summing the product of the sequence values
and the exponential function with a digital frequency. Then we computed DTFT of the signals. We
computed DTFT of the conjugate antisymmetric signals using symmetric property of DTFT and showed
that odd function is purely imaginary.
Conjugation and Conjugate Symmetry Property is defined as:
x∗[n] ←→ X∗(e^−jω)
From the Hermitian symmetry of real signals; If a signal is odd and real, then its DTFT is odd and purely
imaginary. If a signal is even in addition to being real, then its DTFT is also real and even.
Finally, we worked on inverse DTFT. We defined a function for it. Then computed IDTFT using DTFT
function. IDTFT is the process of taking a signal that has been represented in the frequency domain and
transforming it back into the time domain.The IDTFT is defined as follows:
x[n] = (1/N) * sum{k=0 to N-1}(X[k] * e^(j2pink/N))
where x[n] is the time-domain signal, X[k] is the frequency-domain signal, N is the length of the signal, and
j is the imaginary unit.

You might also like