Professional Documents
Culture Documents
no.-
11113011
AIM:-Generate DFT & IDFT
1)DFT:clc;
clear all;
x=input('enter the sequence');
N=length(x);
for k=1:N
x(k)=0;
for n=1:N
x(k)=x(k)+x(n)*exp(-j*2*pi*(k-1)*(n-1)/N);
end
end
disp(abs(x));
subplot(3,1,1);
stem(abs(x));
subplot(3,1,2);
disp(angle(x));
stem(angle(x));
Graph:30
20
10
0
1.5
2.5
3.5
1.5
2.5
3.5
2
1
0
-1
-2
1
2)IDFT:clc;
clear all;
x=input('enter the sequence');
N=length(x);
for n=1:N
x(n)=0;
for k=1:N
x(n)=x(n)+x(k)*exp(j*2*pi*(n-1)*(k-1)/N);
end
end
disp(abs(x));
subplot(3,1,1);
stem(abs(x));
subplot(3,1,2);
disp(angle(x));
stem(angle(x));
Graph:30
20
10
0
1.5
2.5
3.5
1.5
2.5
3.5
2
1
0
-1
-2
1
30
20
10
0
1 .5
2 .5
3 .5
1 .5
2 .5
3 .5
2
1
0
-1
-2