# Frequency spectrum with fft of a real valued array...?

Holger postbox.holger at gmx.net
Mon Jan 22 14:05:00 CET 2007

```Hello Robert!

Thank you for your tips. They were very useful.

Bye Holger

Am 11.01.2007, 19:08 Uhr, schrieb Robert Kern <robert.kern at gmail.com>:

> Holger wrote:
>
>> What does it mean to me? How do I get to the wanted frequenca
>> spectrum???
>
> It's packed in the conventional FFT format. Here is a function in numpy
> (the
> successor to Numeric, which I assume that you are using) that generates
> the
> corresponding frequencies in the same packed format:
>
> In : import numpy
>
> In : numpy.fft.fftfreq?
> Type:           function
> Base Class:     <type 'function'>
> Namespace:      Interactive
> File:
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy-1.0.2.dev3507-py2.5-macosx-10.4-i386.egg/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
>
>

```