You are on page 1of 2

Digital Signal Processing (CE-320L) 2020F-CE-117

LAB # 14
OPEN ENDED LAB-II
OBJECT: To show the implementation of DFT & IDFT.
LAB TASK:
Task 1: Perform DFT of any sequence.

Source Code:

function X = FFT(x)
N = length(x);
if N == 1
X = x;
else
X_even = FFT(x(1:2:N));
X_odd = FFT(x(2:2:N));
for k = 0:N/2-1
X(k+1) = X_even(k+1) + exp(-1i*2*pi*k/N)*X_odd(k+1);
X(k+N/2+1) = X_even(k+1) - exp(-1i*2*pi*k/N)*X_odd(k+1);
end
end
end

Output:

Computer Engineering Department


Sir Syed University of Engineering & Technology
Digital Signal Processing (CE-320L) 2020F-CE-117

Task 2: Perform IDFT of the same sequence given in task 1.

Source Code:

function x = IFFT(X)
N = length(X);
if N == 1
x = X;
else
X_even = IFFT(X(1:2:N));
X_odd = IFFT(X(2:2:N));
for k = 0:N/2-1
x(k+1) = (X_even(k+1) + exp(1i*2*pi*k/N)*X_odd(k+1))/N;
x(k+N/2+1) = (X_even(k+1) - exp(1i*2*pi*k/N)*X_odd(k+1))/N;
end
end
end

Output:

CONCLUSION:
In mathematics, the discrete Fourier transform (DFT) converts a finite sequence of equally spaced
samples of a function into a same-length sequence of equally-spaced samples of the discrete-time
Fourier transform (DTFT), which is a complex-valued function of frequency. In contrast, the IDFT
can be used to invert the DFT samples, allowing one to reconstruct the signal samples directly from
its frequency domain form. The Discrete Fourier Transform (DFT) and the Inverse Discrete Fourier
Transform (IDFT) are commonly used in signal processing applications, in particular in digital
communication systems using the multi-carrier modulation principle.

Computer Engineering Department


Sir Syed University of Engineering & Technology

You might also like