Why do we get different imaginary parts of a zero centered Gaussian for the the same number of data points N? Suppose we have a total number N= 2048 points in a data and we wish to have zero centered Gaussian. There are two possibilities that we use the x-axis as

x1=[-1023:1:1024]; % x axis spans from -1023 to 1024 with 1 unit steps

x2=[-1024:1:1023]; % x axis spans from -1024 to 1023 with 1 unit steps


and if we make two zero centered Gaussians using these x values:

Gauss1=normpdf(x1,0, 10); % The syntax is normpdf(x, mean, standard deviation)


Gauss2=normpdf(x2,0,10);


and obtain their FTs as follows in MATLAB.

FFTGauss1=fft(Gauss1);
FFTGauss2=fft(Gauss2);


The real parts are identical and their magnitudes exactly match. For some reasons, the imaginary parts vary drastically. Why do we see large imaginary parts in one case and almost non-existent imaginary parts in the other? Thanks.
Answer : When $x_2 = [-1024:1:1023]$, then $x_2[n]$ satisfies the condition $x_2[n] = x_2[(N-n)\mod N]$. That is why when $x_2 = [-1024:1:1023]$, then the FFT is real and hence the imaginary part is $0$. If you see the scale of the $y$-axis for imaginary part of $x_2$ plot, it is of the order of $10^{-17}$ which is almost $0$ in MATLAB.

Detailed Explanation:

When $x \in \{-1024, -1023, -1022,..., 0, 1, 2, ..., 1023\}$, then you get the following mapping :
$$\begin{array}{lcl}x[0] &amp;=&amp; {\rm gaussian}(-1024)\\
x[1] &amp;=&amp; {\rm gaussian}(-1023)\\
x[2] &amp;=&amp; {\rm gaussian}(-1022) \\ 
&amp; \vdots\\
x[1024] &amp;=&amp; {\rm gaussian}(0)\\
x[1025] &amp;=&amp; {\rm gaussian}(1) \\ 
&amp; \vdots \\
x[2047] &amp;=&amp; {\rm gaussian}(1023)\end{array}$$ Observe that $x[1] = x[2047] = x[(2048 - 1)\mod\ 2048]$, $x[2] = x[2046] = x[(2048 - 2)\mod \ 2048]$ and so on. This makes $x[n]$ real and symmetric mod $N$, which will in turn make $X[k]$ real and that is why you see that the imaginary part as $0$. MATLAB shows $0$ as values of the order of $10^{-17}$.

Do the same mapping for $x = [-1023:1:1024]$, and you will see that $x[n] \ne x[(N-n)\mod \ N]$ and hence imaginary part is not $0$.