Forgive me if I am missing understanding something simple here but I am confused by exactly what the FFT function returns in Matlab. I have code to compare the result of FFT to the analytic result of the fourier transform of a gaussian:
steps = 2^10; lim = 4;
x = linspace(-lim, lim, steps);
w = lim/4; A = 1;
func = A*exp((-1).*(x./w).^2);
Analytic = sqrt(pi)*w*exp(-(w*pi.*x).^2);
Func = fftshift(fft(func));
When I plot this, the fft function looks nothing like the analytic result:
If anyone could shed some light on why this is and how I can adapt my use of the FFT function to give me back the analytic result I would greatly appreciate it!
I am asking this question as I have been developing some code to model the propagation of various beams through a turbulent medium using phase screens. For the code to be valid it is important that the Fourier Transforms produced agree with Physics.