Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

SUNIL MEENA

2018UEC1016

Experiment 10
AIM: To find the DFT and IDFT of given sequence using MATLAB
SOFTWARE USED: MATLAB THEORY:
DFT: DFT: The discrete Fourier transform (DFT) is the primary transform used for numerical
computation in digital signal processing. It is very widely used for spectrum analysis, fast
convolution, and many other applications.
𝑵
𝑿[𝒌] = ∑ 𝒙(𝒏)𝒆−𝒊( 𝑵 )
𝒏=𝟎

The DFT is widely used in part because it can be computed very efficiently using fast Fourier
transform (FFT) algorithms.

IDFT: The inverse DFT (IDFT) transforms N discrete-frequency samples to the same number
of discrete-time samples. The IDFT has a form very similar to the DFT
𝑵
𝒙[𝒌] = 𝟏/𝑵 ∑ 𝑿(𝒌)𝒆𝒊( 𝑵 )
𝒏=𝟎

TWIDDLE FACTOR IN CALCULATION OF DFT, IDFT AND FFT: The above DFT equation using the
twiddle factor can also be written in matrix form. The matrix form of calculating a DFT and an
IDFT eases up many calculations. X(k) = WNx(n)

Similarly, an IDFT can be calculated using a matrix form using the following equation. 𝑥(𝑛) =
𝑊𝑁𝑥∗ /𝑁

Here, 𝑊𝑁𝑥∗ is the complex conjugate of the twiddle factor. To get the values of the complex
conjugate, just invert the signs of the complex components of the twiddle factor. For example:
The complex conjugate of 0.707+0.707j will become 0.707-0.707j.
SUNIL MEENA
2018UEC1016

MATLAB CODE:
clc; clear
all; close
all;

x=[1 2 3 4];
N=length(x);
Y=fft(x); z=ifft(x);
Xk=zeros(1,N);
Xki=zeros(1,N);

i=sqrt(-1); for
k=0:N-1 for
n=0:N-1
Xk(k+1)=Xk(k+1)+(x(n+1)*exp(-1*i*2*pi*k*n/N));
end end

figure(1)

subplot(2,1,1) stem(Y);
title('DFT using inbuilt function');
grid on; subplot(2,1,2) stem(Xk);
grid on;
title('DFT using Loop method');
for k=0:N-1 for n=0:N-1
Xki(k+1)=Xki(k+1)+(x(n+1)*exp(i*2*pi*k*n/N));
end end Xki=(1/N)*Xki;
figure(2)

subplot(2,1,1)
stem(z); grid
on
title('IDFT using inbuilt function');

subplot(2,1,2)
stem(Xki); grid
on
title('IDFT using Loop method');
SUNIL MEENA
2018UEC1016

CONCLUSION: DFT and IDFT of a discrete signal x is successfully calculated and studied.

You might also like