The Gaussian f[x]
you are transforming is given by your PDF statement. The corresponding frequency-domain Gaussian is given by
FourierTransform[f[x], x, w]
which is the same function with w
replacing x
, that is, f[w]
. The discrete Fourier transform on numerical data, implemented by Fourier
, assumes periodicity of the input function. Hence, the Testdata
you supply is seen by Fourier
as a function of the following form, with an infinite number of peaks ranging from minus infinity to infinity.
Testdata = Array[f, 100, {-2, 2}];
ListLinePlot[Join[Testdata, Testdata, Testdata], Frame -> True,
DataRange -> {-150, 150}]
Note that the function does not reach zero, as an actual Gaussian would (in the limit). This offset means that you are not actually transforming a Gaussian function when you input Testdata
to Fourier
. A better approximation would be to sample more of the tails of the true Gaussian. In addition, with your Array
formulation, the replications assumed by Fourier
cause a double-sampling the points at f[-2]
and at f[2]
. It is better to match endpoints so that, when replicated, the (approximate) Gaussians match seemlessly. The following table of f[x]
extends the range to better sample the tails, matches endpoints, and centres on zero (the first sample).
TestdataFull = RotateRight[Table[f[x], {x, -5.0, 5.0 - 1.0/10., 1.0/10.}], 50];
ListLinePlot[TestdataFull, Frame -> True]
Fourier
returns complex data even if the input signal is real. However, by matching endpoints and sampling the Gaussian more fully, the imaginary part is now essentially noise.
GraphicsRow[{
ListLinePlot[Re[Fourier[TestdataFull]][[Range[20]]],
PlotRange -> All, Frame -> True, PlotLabel -> "Real Component"],
ListLinePlot[Im[Fourier[TestdataFull]][[Range[20]]],
PlotRange -> All, Frame -> True, PlotLabel -> "Imaginary Component"]}]
Take the magnitude of the complex, yet essentially real, data returned by Fourier, and centre the peak. There's your real Gaussian.
ListLinePlot[RotateRight[Abs[Fourier[TestdataFull]], 50],
PlotRange -> All, Frame -> True]
Fourier
? $\endgroup$