0% found this document useful (0 votes)
4 views3 pages

SH 8 DFT

The document outlines the objectives and implementation of the Discrete Fourier Transform (DFT) using MATLAB, focusing on the analysis and synthesis of discrete-time signals. It provides mathematical definitions for DFT and its inverse (IDFT), along with MATLAB code examples for computing and visualizing the DFT of various sequences. Additionally, it includes experimental steps and questions aimed at enhancing understanding of spectrum density and resolution, as well as the differences between DFT, IDFT, and DTFT.

Uploaded by

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

SH 8 DFT

The document outlines the objectives and implementation of the Discrete Fourier Transform (DFT) using MATLAB, focusing on the analysis and synthesis of discrete-time signals. It provides mathematical definitions for DFT and its inverse (IDFT), along with MATLAB code examples for computing and visualizing the DFT of various sequences. Additionally, it includes experimental steps and questions aimed at enhancing understanding of spectrum density and resolution, as well as the differences between DFT, IDFT, and DTFT.

Uploaded by

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

Discrete Fourier Transform (DFT)

Objectives
- To study and implement Discrete Fourier Transform (DFT) using MATLAB.
- To learn the analysis and synthesis of discrete-time signals using DFT and IDFT,
respectively.

Introduction
The discrete-time Fourier transform (DTFT) provides frequency-domain
representation of sequences. DTFT is a function of the continuous variable (), which is
defined for infinite-length sequences. This is impractical because it makes DTFT a
numerically incomputable transform.
Therefore, attention is turned to a numerically computable transform, obtained by
sampling DTFT in the frequency domain. When applied to finite-duration sequences, it
gives us a new transform called Discrete Fourier Transform (DFT), which is the ultimate
numerically computable Fourier transform.
The Discrete Fourier Transform of an N-point sequence is given by:

N 1
X (k )   x(n)WNnk , 0  k  N 1 (1)
n 0
2
j
where W N  e N . Note that X (k ) (which is the result of DFT) is also an N-point
sequence, where: 0  k  N  1.
The inverse discrete Fourier transform (IDFT) of an N-point signal X (k ) is given by:

N 1
1
x ( n) 
N
 X (k )W
k 0
 nk
N , 0  n  N 1 (2)

In MATLAB, an efficient implementation of DFT and IDFT would be to use a matrix-


vector multiplication for the relations in equations (1) and (2). If x(n) and X (k ) are
arranged as row vectors x and X, respectively, then from equations (1) and (2) we have:

X  xWN (3)
1
x  XWN , (4)
N
where WN and WN are the DFT matrix and its conjugate, respectively. The following
MATLAB functions are used to implement the above equations:

1
function [Xk] = dft(xn, N)

n = [0:1:N-1]; % row vector for n


k = [0:1:N-1]; % row vector for k
WN = exp(-j*2*pi/N); % Wn factor
nk = n'*k; % creates a NxN matrix of nk values
WNnk = WN .^ nk; % DFT matrix
Xk = xn * WNnk; % row vector for DFT coefficients
% End of function

function [xn] = idft(Xk, N)

n = [0:1:N-1]; % row vector for n


k = [0:1:N-1]; % row vector for k
WN = exp(-j*2*pi/N); % Wn factor
nk = n'*k; % creates a NxN matrix of nk values
WNnk = WN .^ (-nk); % IDFT matrix
xn = (Xk*WNnk)/N; % row vector of IDFT values
% End of function

Experiment
1. For the sequence x(n)  [1, 1, 1, 1] , use the following MATLAB commands to compute
DFT:
x = [1, 1, 1, 1]; N = 4;
X = dft(x, N);
magX = abs(X);
phaX = angle(X)*180/pi;

2. Plot the magnitude and phase of the DFT signal in step (1).
3. Apply zero-padding operation, which is a technique that allows us to sample at dense (or
finer) frequencies, to get an 8-point sequence. Then compute its DFT. Use the following
MATLAB commands:
x = [1, 1, 1, 1, zeros(1,4)]; N = 8;
X = dft(x, N);
magX = abs(X);
phaX = angle(X)*180/pi;

4. Plot the magnitude and phase of the 8-point DFT signal in step (3).
5. Treat x(n) in step (1) as a 16-point sequence by padding 12 zeros instead of 4 zeros. Plot
the magnitude and phase of the resulting 16-point DFT signal.
6. For the sequence: x(n)  cos(0.48n)  cos(0.52n) , use the following MATLAB
commands that determine the 10-point DFT of x(n) to obtain an estimate of its DTFT:
n = [0:1:99]; x = cos(0.48*pi*n)+cos(0.52*pi*n);
n1 = [0:1:9]; y1 = x(1:1:10);
subplot(2, 1, 1); stem(n1, y1);

2
title('signal x(n), 0 <= n <= 9');
xlabel('n');
Y1 = dft(y1, 10); magY1 = abs(Y1(1:1:6));
k1 = 0:1:5; w1 = 2*pi*k1/10;
subplot(2, 1, 2); plot(w1/pi, magY1);
title('DTFT Magnitude');
xlabel('Frequency in pi units');

7. Use the following commands that pad 90 zeros to x(n) in step (6) to obtain a dense
spectrum:
n2 = [0:1:99]; y2 = [x(1:1:10) zeros(1,90)];
subplot(2, 1, 1); stem(n2, y2);
title('signal x(n), 0 <= n <= 9 + 90 zeros');
xlabel('n');
Y2 = dft(y2, 100); magY2 = abs(Y2(1:1:51));
k2 = 0:1:50; w2 = 2*pi*k2/100;
subplot(2, 1, 2); plot(w2/pi, magY2);
title('DTFT Magnitude');
xlabel('Frequency in pi units');

8. Use the following commands to determine DTFT for the first 100 samples of x(n) :
subplot(2, 1, 1); stem(n, x);
title('signal x(n), 0 <= n <= 99');
xlabel('n');
X = dft(x, 100); magX = abs(X(1:1:51));
k = 0:1:50; w = 2*pi*k/100;
subplot(2, 1, 2); plot(w/pi, magX);
title('DTFT Magnitude');
xlabel('Frequency in pi units');

9. Use the following commands to synthesize the sequence x(n) using the Inverse Discrete
Fourier Transform (IDFT):
x1 = idft(X, 100);
subplot(2, 1, 2); stem(n, x1);
title('Synthesized x(n)');
xlabel('n');

Questions
1. How can you improve the spectrum density?
2. How can you improve the spectrum resolution?
3. What are the differences between DFT and IDFT?
4. What are the differences between DFT and DTFT?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy