Discrete Fourier Transform in MATLAB

Click For Summary

Discussion Overview

The discussion revolves around the application of the discrete Fourier transform (DFT) in MATLAB, specifically concerning the transformation of a Gaussian-distributed variable. Participants explore the differences between the continuous Fourier transform and the discrete version, particularly focusing on the unexpected results observed in the DFT output.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant notes that the continuous Fourier transform of a Gaussian function results in a Gaussian in k-space, while the discrete Fourier transform yields a different distribution, suggesting a form of f(k)~sin(k)exp(-k^2).
  • Another participant questions whether the original poster used fftshift after the fft, implying that this could affect the results.
  • A different participant prompts the original poster to consider whether they examined the modulus or just the real part of the transform, hinting at potential insights from the properties of Fourier transforms.
  • One participant explains that MATLAB treats the input sequence as periodic, which may lead to the observed discrepancies due to the finite length of the data. They suggest that the result is a convolution of a sinc function and a Gaussian due to this periodicity.
  • The original poster expresses confusion over a phase shift in the imaginary part of the transform, indicating that they expected it to vanish.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the reasons behind the differences in results between the continuous and discrete Fourier transforms. Multiple viewpoints and explanations are presented, indicating ongoing uncertainty and exploration of the topic.

Contextual Notes

The discussion highlights limitations related to the assumptions of periodicity in the DFT and the implications of finite data length on the Fourier transform results. There is also mention of the need for careful consideration of the real and imaginary components of the transform.

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 ·
Replies
0
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 2 ·
Replies
2
Views
15K
  • · Replies 1 ·
Replies
1
Views
3K