[Numpy-FFT] data output format

Bengt Richter bokr at oz.net
Wed Oct 22 03:12:46 EDT 2003


On Tue, 21 Oct 2003 15:40:18 -0400, Peter Hansen <peter at engcorp.com> wrote:

>Giovanni Ciampaglia wrote:
>> 
>> Hello everyone,
>> Could someone explain me what is the "steady-state" value contained into the
>> array returned by FFT.fft(data,n=None,axis=-1) at its first position?
>> Is it one of the values calculated by the FFT algorithm or some sort of control
>> value different from the other elements of the array?
>
>That would likely be what I'd have called the DC (from Direct Current) value,
>representing a constant offset from zero in the signal being transformed.
>
>Basically thing of it as 0 Hz (the unchanging portion of the signal), therefore 
>no different from a constant offset, or "steady-state" as the man said.
>
>Note that depending on how the FFT is calculated, this steady-state value will
>likely include some amount of the near-zero frequencies, since each bin really
>represents the contributions of a range of frequencies, rather than just 
>single, precise frequency values.
I like to think of it loosely as how well the data correlates with a signal
of the exact bin frequency, with phase revealed by the complex result.

>
>To answer the latter question then, it's just one of the values calculated
>by the FFT, "no different" from the others (except for its uniqueness in being
>from the unchanging portion of the input).

Well, there is a real (pun intended ;-) uniqueness about the zero frequency value. I.e.,
I'd add that if the input is a sequence of real values (zero imaginary component) then
the first FFT value will be all real also, since IIRC it will the sum of all the vaues
multiplied by cos(0). The other unique value also guaranteed to be all real is at the
frequency of N/2 cycles per N-sample window, where the coefficients are also all real
and alternate cos(0), cos(pi). Since the result for all-real input is also symmetric
across the folding frequency, some FFT's exploit both symmetry and special reals and
store the value of the N/2 frequency output in the memory slot for the imaginary part
of the complex zero frequency value (so you have to split out the two values), and can
thus store the entire result destructively replacing the input in place. At least I did
that once upon a time, IIRC from ~3 decades ago, when doing that inside the 4k words of
"fast" 300ns memory (that IIRC cost more than six new VW bugs) was important ;-)

Regards,
Bengt Richter




More information about the Python-list mailing list