Discrete Fourier transform of real valued Gaussian using FFT
Show older comments
Hi all,
I have a question regarding the computation of the discrete Fourier transfrom of a real valued Gaussian function using the FFT routine in MATLAB. First I define the discrete grids in time and frequency
% grid in time
tn = linspace(-10.0,10.0,128);
% grid in frequency
fn = tn/(20.0*20.0/128);
% Gaussian function in t-domain
gauss = exp(-tn.^2);
The Gaussian function is shown below

The discrete Fourier transform is computed by
fftgauss = fftshift(fft(gauss));
and shown below (red is the real part and blue is the imaginary part)

Now, the Fourier transform of a real and even function is also real and even. Therefore, I'm a bit surprised by the somewhat significant nonzero imaginary part of fftgauss. What is more surprising to me is the oscillations in the real part of fftgauss --- is this due to the discreteness of the transform? The continuous Fourier transform of a real valued Gaussian function is a real valued Gaussian function too...
In order to answer this question, I have written a simple discrete Fourier transform, see below
dftgauss = zeros(128);
for n = 1:128
for m = 1:128
dftgauss(n) = dftgauss(n) + gauss(m)*exp(2.0*pi*i*fn(n)*tn(m));
end
end
and dftgauss is shown below

Clearly, fftgauss and dftgauss are different, though the real part of dftgauss is equal to abs(fftgauss). My discrete Fourier transform actually gives the result that I expected (The continuous Fourier transform of a real valued Gaussian function is a real valued Gaussian function too...).
In short: Why is the real part of fftgauss oscillating?
Accepted Answer
More Answers (0)
Categories
Find more on Spectral Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!