[SciPy-user] FFT indexes with zero-padding
Mon Jan 19 22:22:52 CST 2009
On Mon, Jan 19, 2009 at 22:18, Forrest Sheng Bao <email@example.com> wrote:
> I am thinking about a question regarding the indexes of FFT result with
> Suppose there is no zero-padding that the length of signal is a power of 2,
> like 4096. Then the index corresponding to frequency f should be f/fs*N,
> where fs is the sampling rate and N is the number of points.
> But, what if the length of signal is not a power of 2? Like 5000? How does
> Scipy.signal module handle this?
> For example, I have 5000 samples and am doing 5000-point FFT. The sampling
> rate is 200Hz. Is the index for 2 Hz still 2 / 200* 5000 = 50?
In : numpy.fft.fftfreq?
Base Class: <type 'function'>
String Form: <function fftfreq at 0x18a29fb0>
Definition: numpy.fft.fftfreq(n, d=1.0)
fftfreq(n, d=1.0) -> f
DFT sample frequencies
The returned float array contains the frequency bins in
cycles/unit (with zero at the start) given a window length n and a
sample spacing d:
f = [0,1,...,n/2-1,-n/2,...,-1]/(d*n) if n is even
f = [0,1,...,(n-1)/2,-(n-1)/2,...,-1]/(d*n) if n is odd
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-user