How important is it to use power of 2 when using FFT?

50 views (last 30 days)
Here is the problem. I have a 2D array of data, first column represents the time data and the second column represents the sinusoidal response data, based on the time data. I apply fft and I get my frequency (that I started with) in a specific bin as I expected and I find the amplitude and phase angle from that bin. Now the problem is I have the same set up but with more data points, I apply the fft again and the bin number changes (which is normal and it is where I expect it to be), the amplitude is the same but the phase angle is different) first is this normal? second, what approach should I take? Thank you
PS: neither of the set ups (mentioned above) give data of length of power of 2, say the first one gives 1620 data points and the second one gives 1745 data points, so should be taking the next power of 2 for both from the beginning? PSS: I have posted similar question before, here is the link, but even though i received an answer, just did not make a whole sense to me, so I am hoping to get better insight. http://www.mathworks.com/matlabcentral/answers/64423-does-fft-always-require-2-n-sample-points

Accepted Answer

dpb
dpb on 24 Jul 2013
Edited: dpb on 25 Jul 2013
A) The phase is representative of the sample phase; if the two samples are collected w/o a specific triggering then they will not (in all likelihood and except by chance) have the same phase. So, yes it is normal under those circumstances.
B) The power-of-2 is only significant in that there are algorithms for implementation that are very efficient for those lengths of inputs. Other routines exist for other lengths which are multiples of small primes, for example. But, the Matlab implementation is general-enough to handle any N and with today's compute power the extra efficiency of a power-of-2 length is rarely needed.
That isn't always true, of course--for an embedded instrument or perhaps for a realtime analysis it might be needed, but in general don't worry about it unless needed--and if the extra performance is needed you'll know it soon enough. :)
My (admittedly somewhat dated but hey I'm the age of dirt) favorite reference for such introductory stuff has always been Brigham, O.A., The FFT and Its Applications, Prentice Hall.
  1 Comment
Nina
Nina on 25 Jul 2013
I will totally check that reference out, I am in need of some good reading about this kind of things, thanks a lot for the explanation, makes better sense now!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!