title: Inverse fast fourier transform in MATLAB
body: <p>My MATLAB code for <code>fft</code> and <code>ifft</code> below has a problem with the inverse Fourier signal <code>y</code> not matching the in put signal <code>x</code>. Is there any solution to resolve this?</p>
  
  <pre><code>N = 1000;
  t0 = 1e-13;
  tau = 2*1e-14;
  n = [0:t0/40:2*1e-13-t0/40];
  f0 = 3*1e8/(150*1e-9);
  
  x = cos(2*pi*f0*n);
  x = x.*exp((-(n-t0).^2)./(tau^2));
  X = abs(fft(x,N));
  F = [-N/2 : N/2 - 1]/N;
  X = fftshift(X);
  y=ifft(X,80);
  
  figure(3)
  plot(n,y)
  </code></pre>