Discrete Fourier transform of real valued Gaussian using FFT
조회 수: 12 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
채택된 답변
Greg Heath
2012년 6월 17일
If T = N*dt and Fs = 1/T.
t = linspace(- (T - dt)/2 , (T - dt)/2 , N ) % N odd
or
t = linspace( - T/2 , T/2 - dt , N ) % N even
and
f = linspace(- (Fs - df)/2 , (Fs - df)/2 , N ) % N odd
or
f = linspace( - Fs/2 , Fs/2 - df , N ) % N even
Then
X = fftshift(fft(ifftshift(x)))
Hope this helps.
Greg
댓글 수: 5
Morgane Borreguero
2016년 10월 12일
Sorry Greg I don't understand your Notation. Could you maybe help me or use the same Notation than Jakob Petersen? I would be gratefull. What are you T and N and so on?
Greg Heath
2016년 10월 17일
Fs = 1/dt = N/T = N*df
N time points equally spaced over the temporal period T with spacing dt = T/N
are mapped into N frequency points equally spaced over the spectral period Fs with spacing df = Fs/N
This is standard notation for Fourier Series.
See any Fourier series reference.
Hope this helps.
Greg
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!