DSPRelated.com
Forums

IDFT

Started by gatzos_barca November 30, 2007
Hello

I've written this programme to compute idft but for some reason it
doesnt work... can someone please help me with that??? I know its
probably something there i dont see...

%
% Inverse Discrete Fourier Transform
%
function x = idft(Xn)

N = input('Type the lenght of the sequence =');
M = input('Type the lenght of the transform =');

[N,M] = size(Xn);
if M ~= 1, % makes sure that Xn is a column vector
Xn = Xn.';
N = M;
end
x=zeros(N,1);
n = 0:N-1;
for k=0:N-1
x(k+1) = exp(j*2*pi*k*n/N)*Xn;
end
x = x/N;