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?
Answer
Modern FFT libraries, such as FFTW and Apple's Accelerate framework can do non-power-of-2 FFTs very efficiently, as long as all the prime divisors of the composite length are fairly small (2,3,5,etc.)
A power of 2 makes it simpler (about 1 page of source code) if you have to code your own FFT for some reason, or are otherwise constrained as to max program length (or FPGA gates, etc.)
For phase measurement, it might be easier to do an fftshift (pre-rotate the data by N/2) to reference FFT phase to the center of the data window, where the evenness/oddness ratio, and thus the phase won't change or alternate with bin number (for phase that is the same at the center of that data window) even for signals that are non-periodic in the FFT length, as you vary the length.
No comments:
Post a Comment