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