MATLAB Discrete Fourier Transform in MATLAB

AI Thread Summary
The discussion revolves around performing a discrete Fourier transform (DFT) of a Gaussian-distributed variable in MATLAB. The original poster notes that while the continuous Fourier transform of a Gaussian results in a similar Gaussian in k-space, the DFT yields a distribution that includes a sine component, leading to confusion. Responses clarify that MATLAB's FFT assumes periodicity, which alters the expected results when the input data is finite. The convolution of the Gaussian with a sinc function due to this periodicity explains the unexpected output. The original poster expresses gratitude for the clarification, indicating that the explanation resolved their issue.
SamuraiJack
Messages
9
Reaction score
0
Hello all, first time here and I have really silly problem...
I am working on something in MATLAB, in which I have to make discrete Fourier transform
of gaussian distributed variable. i.e. array of numbers which are taken from f(x)~exp(-x^2). I know that when you Fourier transform it with integral you get the same distribution in k-space. i.e. f(k)~exp(-k^2), but in the discrete transform I get the distribution something like f(k)~sin(k)exp(-k^2)...

help! someone... why?

Thnx,

The Samurai.
 
Physics news on Phys.org
It's hard to know what's going on from your vague description. Did you use fftshift after the fft?
 
Did you look at the modulus or just the real part? Hint: f(x)-> F(y); f(x-a) -> ?
 
Hello marcusl, thank you for your response. Let me change the question since it doesn't really matter if it is in MATLAB or not. If you are doing Fourier transform from x to k space to a gaussian f(x)~exp(-x^2), you get f(k)~exp(-k^2). However, doing discrete Fourier transform to set of values in the x space which are distributed as f(x)~exp(-x^2), you get set of values that are distributed as f(k)~sin(k)exp(-k^2). I thought that in the limit Delta x -> 0, the transforms should be almost the same but they are clearly different.
WHY?

Delta Kilo, I also checked modulus. But actually the real part in negligible. (which is also a problem, because in this transform, the imaginary part should vanish, there is a mysterious pi/2 phase shift. How ever, with this problem I can live)



thanks again.
 
Hi SamuraiJack,

I haven't worked with Matlab for ages but I remember a few things:

FFT is for perioidc sequences and Matlab makes your sequence periodic to calculate the FFT. When you give the sequance withing an interval, Matlab assumes that this is only one period if a periodic data. When the length of the sequence is infinite, you get the expected Fourier sequence.

Since your data length is limited, it is equal to your Gaussian sequence multiplied by a square function. As we know the the FFT for this mutiplication is the convolution of their FFT, which is the convolution of a sinc function and a Gaussian one.This is what your current result is.
 
Hello Hasan,
Although I watched it one week later... This is exactly the answer I was looking for.

Thanks.
 

Similar threads

Replies
0
Views
2K
Replies
5
Views
1K
Replies
1
Views
6K
Replies
10
Views
3K
Replies
7
Views
2K
Replies
7
Views
5K
Replies
2
Views
2K
Back
Top