DISCRETE FOURIER TRANSFORM

clc;
close all;
clear all;
x=input('Enter the Input Sequence:')
N=length(x);
j=sqrt(-1);
stem(x);x
title('Given Sequence');
xlabel('n');
ylabel('amp');
pause;
for r=0:2
for n=1:N
x(r*N+n)=x(n);
t(r*N+n)=r*N+n;
end
end
for k=1:N
y(k)=0;
for n=1:N
p=(j*2*pi*(n-1)*(k-1))/N;
y(k)=y(k)+[x(n)*exp(-p)];
end
end
subplot(3,1,1);
stem(y);y
title('Discrete Fourier Transform');
xlabel('k');
ylabel('amp');
subplot(3,1,2);
stem(abs(y));abs(y)
title('Magnitude of Discrete Fourier Transform');
xlabel('k');
ylabel('amp');
subplot(3,1,3);
stem(atan2(imag(y),real(y)));atan2(imag(y),real(y))
title('Phase of Discrete Fourier Transform');
xlabel('k');
ylabel('angle');

Input:


Enter the Input Sequence:[1 0 1 0 1 0 1 0]

Output:

No comments:

Post a Comment