You are on page 1of 3

LAB-3

Gaurav Kumar Singh [11BEE1019]

AIM:
(a) To obtain the discrete Fourier transform of a given sequence without using any direct
MATLAB formula.
(b)To obtain the inverse discrete Fourier transform of a given sequence without using any
direct MATLAB formula.
(a) codeclear all;
clc;
syms n k;
xn=input('enter the sequence of signal = ')
N=length(xn);
x_n=transpose(xn);
n=[0:N-1];
k=[0:N-1];
k1=transpose(k);
nk=-i*k1*n*2*pi/N;
w_nk=exp(nk);
X_K=w_nk*x_n
m=abs(X_K);
A=angle(X_K);
subplot(121)
stem(m)
title('magnitude');
subplot(122)
stem(A)
title('angle');
X_chk=fft(xn)
OUTPUT:
enter the sequence of signal = [1 -2 3 4]
xn =
1 -2

X_K =
6.0000
-2.0000 + 6.0000i
2.0000 - 0.0000i
-2.0000 - 6.0000i

X_chk =
6.0000

-2.0000 + 6.0000i 2.0000

-2.0000 - 6.0000i

(b)
enter the sequence of FFT of signal = [1 1-2*i -1 1+2*i]
X=
1.0000

1.0000 - 2.0000i -1.0000

x_n =
0.5000
1.5000 - 0.0000i
-0.5000 + 0.0000i
-0.5000 + 0.0000i

x_chk =
0.5000

1.5000 -0.5000 -0.5000

1.0000 + 2.0000i

You might also like