Re: FFT for N Not a Power of 2



In article <4926F19F.4050708@xxxxxxxxxxxxxxxxxx>,
Phil Hobbs <pcdhSpamMeSenseless@xxxxxxxxxxxxxxxxxx> wrote:

Bill Davy wrote:
"Phil Hobbs" <pcdhSpamMeSenseless@xxxxxxxxxxxxxxxxxx> wrote in message
news:4922B772.7090503@xxxxxxxxxxxxxxxxxxxxx
W. eWatson wrote:
It would seem that the FFT is applicable to only data with a number of
observations that are a power of 2. Is that correct? If so, does one only
remove the largest number of observations that are a power of 2, while
ignoring the remainder?
No.

There are FFT algorithms that work for any N, including prime numbers, but
they're a few times less efficient than radix-2 FFTs.


Not sure that's right. I have a feeling that radix 4 and perhaps radix 8
are more efficient than radix 2 and that some transforms (I seem recall one
by Singleton in an IEEE publication) used large factors. And somewhere
there is a program that will generate an efficient FFT program for a
specified number. Of course, if it's a prime, you're stuffed.


You're only stuffed if you're Tukey. ;) The fast algorithsm for prime N
iiuc involve taking two different chirp-Z transforms in a row, but
they're still N log N algorithms, like the Cooley-Tukey and Sande-Tukey
algorithms. It's true that the quicker FFTs, e.g. FFTW don't use a pure
radix-2 approach--but it sounds as though the OP is trying to understand
FFT spectral estimation. Misapplied FFTs are famous for generating
reasonable-looking wrong answers, so becoming clear on what's actually
going on is the first order of business.

Plausible but wrong for sure. I once did this to myself while using
Mathematica to simulate third order intermodulation in the receive path
of a UHF radar.

Because this was simulation, I used test tones with periods that were
both exact multiples of the sampling window, thus eliminating splice
errors when the FFT did its job. However, I got an odd-looking "noise
floor" (there being no noise in the simulation) at -30 to -50 decibels
below the two carriers, with floor rising near the two tones. Now given
that Mathematica uses 64-bit IEEE-754 Double Floats for such things, one
would expect a floor around -300 dBc caused by accumulated roundoff
errors.

At first I thought that Mathematica was not correctly handling FFTs with
lengths not a power of two, but later discovered the true problem: One
had to ensure that the length of the window and periods of each of the
two test tones were such that there was no discontinuity at the splice
when one notionally rolled the window into a cylinder. Being off by
even one sample generated enough wideband "energy" to raise the floor
everywhere. It was not enough the the number of samples be a power of
two, although that did yield the shortest run times. This also
explained why the larger the length of the window (in samples),the lower
the floor - the "energy" was of fixed magnitude and was being spread
uniformly into the bins of the FFT, so if there were more bins there was
less energy per bin.

Joe Gwinn
.



Relevant Pages

  • Re: windowing and zero-padding
    ... sequence up to the next power of 2 number of samples before computing ... If I want to apply windowing before computing the FFT, ... The window should be the same length as the data, ...
    (comp.dsp)
  • Re: Why is more power required for BASS?
    ... Beware of FFT - that shows energy, not power. ... a steady 1V RMS 1 kHz tone may display ...
    (rec.audio.pro)
  • Re: Windowed FFT power and amplitude spectrum
    ... PS: You can find a nice explenation about coherent power gain on this page: ... > Here is another fascinating question on FFT spectrum!! ... > windowing is applied to the time series before FFT is applied. ... > multiplied by a scaling factor but I am not sure how this scaling factor ...
    (comp.dsp)
  • Re: FFT and DFT
    ... in article 4415D32C.3B47ECE5@xxxxxxxxxxx, Mike Fontenot at ... I use the function cvDFT in Visual C++. ... but the fft requires that the number ... number is a power of 2. ...
    (sci.physics)
  • Re: zero padding radix - 2 FFT
    ... FFT with an odd size. ... Zero padding the FFT to the next power of two ... Now zero pad to the next power of two. ...
    (comp.dsp)