0% found this document useful (0 votes)
36 views6 pages

DSP Lab Expt 4 Manual EECE GITAM-1-6

The document discusses the discrete Fourier transform (DFT) and its properties. It explains that the DFT provides a numerically computable frequency domain representation of finite-duration sequences, avoiding issues with transforms over infinite sequences. The DFT of an N-point sequence is defined, as is the inverse DFT. Properties shown include DFT and IDFT being linear transformations, and zero-padding a sequence to obtain a higher density spectrum for plotting.

Uploaded by

gowri thumbur
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)
36 views6 pages

DSP Lab Expt 4 Manual EECE GITAM-1-6

The document discusses the discrete Fourier transform (DFT) and its properties. It explains that the DFT provides a numerically computable frequency domain representation of finite-duration sequences, avoiding issues with transforms over infinite sequences. The DFT of an N-point sequence is defined, as is the inverse DFT. Properties shown include DFT and IDFT being linear transformations, and zero-padding a sequence to obtain a higher density spectrum for plotting.

Uploaded by

gowri thumbur
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/ 6

24

Exp.No:4. Discrete Fourier Transform and verification of its


properties.
Aim: To analyze DFT, IDFT and verification of its properties.
Software: MATLAB.
The discrete-time Fourier transform provided the frequency
domain(ω) representation for absolutely summable sequences and the
Z-Transform provided a general frequency-domain(z)representation
for arbitrary sequences. These transforms have two features in
common. First, the transforms are defined for infinite-length
sequences. Second, they are functions of continuous variables (ω
or z). From the numerical computation viewpoint (or from MATLAB’s
viewpoint), these two features are troublesome because one has to
evaluate infinite sums at uncountably infinite frequencies. To use
MATLAB, we have to truncate sequences and then evaluate the
expressions at finitely many points. In other words, the DTFT and
Z-Transform are not numerically computable transforms.
Therefore we turn our attention to a numerically computable
transform. It is obtained by sampling the DTFT in the frequency
domain (or the Z-Transform on the unit circle). We develop this
transform by first analyzing periodic sequences. From Fourier
analysis we know that a periodic function (or sequence) can always
be represented by a linear combination of harmonically related
complex exponentials (which is a form of sampling). This gives us
the discrete Fourier series (DFS) representation. We then extend
the DFS to finite-duration sequences, which leads to a new
transform, called the discrete Fourier transform (DFT). The DFT
avoids the two problems mentioned and is a numerically computable
transform that is suitable for computer implementation.

Let x(n) be a finite duration sequence that has N samples over 0 ≤


𝑛 ≤ 𝑁 − 1. The N-point DFT of the sequence x(n)is expressed by
𝑵−𝟏
𝒋𝟐𝝅𝒏
𝑿(𝒌) = ∑ 𝒙(𝒏)𝒆− 𝑵
𝒌
, 𝐤 = 𝟎, 𝟏, … … … . , 𝐍 − 𝟏
𝒏=𝟎

and the corresponding IDFT is


𝑵−𝟏
𝟏 𝒋𝟐𝝅𝒏
𝒙(𝒏) = ( ) ∑ 𝑿(𝒌)𝒆 𝑵 𝒌 , 𝐧 = 𝟎, 𝟏, … … … . , 𝐍 − 𝟏
𝑵
𝒌=𝟎
25

DFT and IDFT as a Linear Transformation:


The formulas for the DFT and IDFT given above may be expressed as
𝑁−1

𝑋(𝑘) = ∑ 𝑥(𝑛)𝑊𝑁𝑘𝑛 , 𝑘 = 0,1, … … . 𝑁 − 1


𝑛=0

𝑁−1
1
𝑥(𝑛) = ( ) ∑ 𝑋(𝑘)𝑊𝑁−𝑘𝑛 , 𝑛 = 0,1, … … . 𝑁 − 1
𝑁
𝑘=0

Where WN is defined as
WN=𝑒 −𝑗2𝜋/𝑁
𝑥(0) 𝑋(0) 1 1 1 …… 1
𝑥(1) 𝑋(1) 1 𝑤𝑁 𝑤𝑁2 …… 𝑤𝑁𝑁−1
Let 𝑥𝑁 = XN= WN =
⋮ ⋮ …… ⋮
⋮ ⋮ ⋮
𝑁−1 2(𝑁−1) (𝑁−1)(𝑁−1)
𝑥(𝑁 − 1) 𝑋(𝑁 − 1) [1 𝑤𝑁 𝑤𝑁 …… 𝑤𝑁 ]

𝟏

𝑿𝑵 = 𝑾𝑵 𝒙𝑵 , 𝒙𝑵 =[𝑾−𝟏
𝑵 ]𝑿𝑵 = 𝑵 𝑾𝑵 𝑿𝑵 --------- DFT & IDFTs.

% DFT of a 4-point sequence:


function [Xk] = dft(xn,N)
% Computes Discrete Fourier Transform
% -----------------------------------
% [Xk] = dft(xn,N)
% Xk = DFT coeff. array over 0 <= k <= N-1
% xn = N-point finite-duration sequence
% N = Length of DFT

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


k = [0:1:N-1]; % row vecor for k
WN = exp(-j*2*pi/N); % Wn factor
nk = n'*k; % creates a N by N matrix of nk values
WNnk = WN.^ nk; % DFT matrix
Xk = xn*WNnk; % row vector for DFT coefficients
magXk = abs(Xk)
phaseXk = angle(Xk)*180/pi;
subplot(311),stem(n,xn,'filled','LineWidth',2,'Color','black');
xlabel('n'),title('x[n]')
xlim([-1 1.5*N]),grid;
subplot(312),stem(n,magXk,'filled','LineWidth',2);
26

xlabel('K'),ylabel('|X(K)|','FontWeight','bold','horizontalAlign
ment','right');
title(['Magnitude of DFT |X(K)| for,',' N= ',num2str(N),'.'])
xlim([-1 1.5*N]),grid;
subplot(313),stem(n,phaseXk,'filled','LineWidth',2,'Color','red'
);
xlabel('K'),ylabel('Phase(degrees)','FontWeight','bold');
title('Phase: \angleH(K)')
grid,xlim([-1 1.5*N]);

Observation:
27

Suppose we take twice the number of points, or N = 8 instead of 4.


This we can achieve by treating x(n) as an 8-point sequence by
appending 4 zeros.

𝑥[𝑛] = {1,1,1,1, 𝑧𝑒𝑟𝑜𝑠(1,4)}


This is a very important operation called a zero-padding operation.
This operation is necessary in practice to obtain a dense spectrum
of signals which we shall see below.
Observation:
% DFT of an 8-point sequence (zero padding):
28

% DFT of an 16-point sequence (zero padding, zeros(1,12))


29

% DFT of a 256-point sequence (zero padding, zeros(1,252))

The zero-padding gives us a high-density spectrum and provides a


better displayed version for plotting. But it does not give us a
high-resolution spectrum because no new information is added to
the signal; only additional zeros are added in the data. To get a
high-resolution spectrum, one has to obtain more data from the
experiment or observations.

Inverse Discrete Fourier Transform:

function [xn] = idft(Xk,N)


% Computes Inverse Discrete Transform
% -----------------------------------
% [xn] = idft(Xk,N)
% xn = N-point sequence over 0 <= n <= N-1
% Xk = DFT coeff. array over 0 <= k <= N-1
% N = length of DFT
%
n = [0:1:N-1]; % row vector for n
k = [0:1:N-1]; % row vecor for k
WN = exp(-j*2*pi/N); % Wn factor
nk = n'*k; % creates a N by N matrix of nk values
WNnk = WN .^ (-nk); % IDFT matrix
xn = (Xk * WNnk)/N; % row vector for IDFT values

You might also like