function f=itdf(D)
% transformada inversa discreta de Fourier

N=length(D);
g=zeros(1,N);
tol=1e-12;
% calculo da IDFT
for ik=1:N
  k=ik-1;
  for ij=1:N
    j=ij-1;
    g(ik)=g(ik)+(1/N)*(D(ij)*exp(1i*j*2*pi*k/N));
  end
  if abs(g(ik)) < tol
    g(ik)=0;
  end
  if imag(g(ik)) < tol
    g(ik)=real(g(ik));
  end
end
f=g;