It is widely known that Fourier transform of complex Guassian function \begin{equation} \mathcal \ F(x)=e^{-j x^2/a} \end{equation} is \begin{equation} \mathcal \ F(f)= A e^{jπ^2f^2a} \end{equation}
It is clear that both the function and its Fourier transform have constant absolute value. That is \begin{equation} \mathcal \ |F(x)|=1 \ \ \ \ \ \ \ for \ all \ \ x \end{equation}
\begin{equation} \mathcal \ |F(f)|=A \ \ \ \ \ \ \ for \ all \ \ f \end{equation}
Now the problem is when I calculate the Fourier transform of $F(x)$ in Matlab using matlab command fft and I plot absolute value of $ |F(f)|\ vs \ f $ using function $abs(F(f))$. Instead of getting a constant value, I get a function which decays on either side (picture attached).
Is there something wrong in my logic?
Absolute value of Fourier transform
%%% Matlab code %%% clc
clear all
L=2e-2;
a=1e-6;
npix=1024;
Fs=(npix-1)/(L);
x=L*(-0.5:1/(npix-1):0.5);
fx=Fs*(-0.5:1/(npix-1):0.5);
I=exp(-1j*(x.^2)/(a));
FI=fftshift(fft(I)/npix);
cFI=exp(-1j*(pi^2)*(fx.^2)*a);
plot(x,imag(I))
figure
plot(x,abs(I))
figure
plot(fx,imag(FI),'m')
figure
plot(fx,abs(FI),'m')