The result of calculating the fourier transform using numerical integration is:
the result of using Matlab's FFT is:
So where did I go wrong here? I know the FT of a Gaussian should be another Gaussian. Shouldn't they be the same? Furthermore I would have thought the
Following a suggestion using the
fftshift function gets me to the following plot, but this looks very different to the original
fft despite documentation stating that it just centres the result around zero frequency.
which is more resembling what I would expect.
omega = linspace(-30,30,1000); t = linspace(-10,10,1000); y = exp(-t.^2./2)/sqrt(2*pi); Yft = fft(y); % Pre-allocate results of integration. Y = zeros(size(omega)); %Integrate. for k=1:length(omega) Y(k) = trapz(t, exp(-t.^2./2)/sqrt(2*pi).*exp(1j*omega(k).*t)); end figure() plot(omega, real(Y), omega, imag(Y)); figure() plot(omega, real(Yft), omega, imag(Yft));