FFT not working on periodic data!?!?!?

6 views (last 30 days)
Bruce
Bruce on 12 Sep 2014
Edited: Bruce on 16 Sep 2014
Hello,
I have data which, when visualized,, displays some very periodic behavior (picture a 2D sine wave). However, when I call the fft2() function on my matrix I only get the zero-frequency bin to be non-zero. I would have expected the very clear periodicity in my data to become clear in the FFT, but it seems that somewhere something's going wrong!
Any ideas, including common mistakes or misunderstandings with fft2 or FFTs in general?
Actually, it's quite weird that, regardless of my data, I only get the zero-frequency bin lighting up in the fft!!
code: (msum2 is my real data)
zMapT2=fftshift(fft2(msum2));
zMapAbs=abs(zMapT2);
imagesc(zMapAbs);
so I'd expect to see some bins lighting up away from the origin, but everything's blue except for the red at the center.
  3 Comments
Rick Rosson
Rick Rosson on 13 Sep 2014
Edited: Rick Rosson on 13 Sep 2014
Please type the following at the command prompt:
mean(msum2(:))
min(msum2(:))
max(msum2(:))
size(msum2)
class(msum2)
What is the value of each of these expressions?
Bruce
Bruce on 13 Sep 2014
mean:23.4562
min:21.5823
max:27.5662
size:256 256
class:double

Sign in to comment.

Answers (2)

Image Analyst
Image Analyst on 13 Sep 2014
See my attached demo.
Can't really say much about your code since you didn't post it all. It might be that you have the signal on a big offset, like the signal is all positive, so that there is a huge DC (zero frequency) term which is so much bigger than your spikes due to your periodic component that you can't see the spikes due to the periodic part. You might try taking the log of your data before you pass it to imshow() or imagesc().
  3 Comments
Bruce
Bruce on 13 Sep 2014
Thanks for your ideas. I tried changing the figure colormap as instructed, but now I just get one white center dot in a sea of black. I also tried doing decibel scaling, to no avail!
msum3=10*log10(max(1,msum2));
proceeded as before, still one lone dot!
See my comment to Rick above - my data doesn't seem that wildly varied, and it doesn't have a huge spike somewhere (right?). So confused - seems so straightforward, can't think of why this particular data set is having issues.
Image Analyst
Image Analyst on 14 Sep 2014
Unless you post your actual data I don't know how much more help we can give.

Sign in to comment.


Rick Rosson
Rick Rosson on 14 Sep 2014
Please try converting the source data to zero mean before taking the FFT:
mu = mean(msum2(:));
msum2 = msum2 - mu;
That will eliminate the DC component, and it should reveal the periodic components in the Fourier domain.
  5 Comments
Bruce
Bruce on 16 Sep 2014
I see. I'll try what you said again, thank Analyst!
Bruce
Bruce on 16 Sep 2014
Edited: Bruce on 16 Sep 2014
Yes, that worked too! They are different images, but the peaks I was after are present in both. I can see the difference between removing the DC spike and just compressing it - very interesting! Thank you both very much for your time. -Bruce

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!