Wednesday, 15 January 2014

MATLAB Program to perform Inverse Discrete Fourier Transform

% Program to perform Inverse Discrete Fourier Transform:
clc;
clear all;
close all hidden;
X=input('The given i/p sequence is X(n): ');
subplot(2,2,[1,2]), stem(X);
title('i/p sequencce X(n)is:');
xlabel('---->n');
ylabel('---->X(n)');grid;
N=length(X);
for n=1:N
x(n)=0;
for k=1:N
x(n)=x(n)+X(k).*exp(1i.*2.*pi.*(n-1).*(k-1)./N);

end
x(n)=x(n)./N;
end
disp('The IDFT of the i/p sequence X(n) is x(n):')
p=0:(N-1);
subplot(2,2,[3,4]), stem(p,abs(x));
title('The IDFT of the i/p sequence X(n) is x(n):');
xlabel('---->n');
ylabel('---->x(n)');grid;
disp(x);

No comments:

Post a Comment