>>>> >
> > It follows the conventional FFT packing:
> >
> > In [9]: numpy.fft.fftfreq?
> > Type: function
> > Base Class: <type 'function'>
> > Namespace: Interactive
> > File: /Users/rkern/svn/numpy/numpy/fft/helper.py
> > Definition: numpy.fft.fftfreq(n, d=1.0)
> > Docstring:
> > 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
>>> Ok, each point in the result of FFT correspond to the frequency bin
> calculated by fftfreq. So the k-th point of the first half points of fft
> output, indexing from 0 to N/2, correspond the physical frequency k*Fs/N.
>> Thus, if I wanna consider a frequency band 2-4Hz while the sampling rate
> is 100Hz and I have 1000 sampled points, then I just need to consider the
> results between the 20th and the 40th points. Is my understanding right?
>
I guess you meant: "frequency band 2-4 kHz". Then yes: take the samples
between 20 and 40.
>>>> >
> >
> > > Consider the single-sided case. If I just plot the FFT result by
> > > plot(fft(my_list_of_data)), the x-coordinate ([0,Pi]) is the image
> > part and
> > > the amplitude is the real part, right?
> >
> > No. I believe that matplotlib (I have to assume this is the plotting
> > library you are using; please state so in the future) just ignores the
> > imaginary part. The X-coordinate is just arange(len(my_list_of_data)),
> > and the Y-coordinate is the real part of the FFT. Because of the
> > packing of the FFT, you will need to rearrange things in order to make
> > a sensible plot. I recommend using fftfreq() to get an array of
> > corresponding frequencies and using fftshift() on both the frequency
> > array and the FFT.
> >
>> I just wanna compute the power spectrum to each physical frequency band.
> Since my signal is real, the FFT result is symmetric. So I think that I can
> neglect the part of negative frequency.
>
Correct. Just take the abs**2 of the FFT coeffs.
L.
--
Lorenzo Bolla
lbolla@gmail.comhttp://lorenzobolla.emurse.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080319/77604fe9/attachment.html