FFT woes

Brian Kelley bkelley at wi.mit.edu
Thu Jan 2 17:29:15 CET 2003

Adding to what eric mentioned about taking the log of zero, perhaps it 
would be better if you plotted the periodogram of that data.  I expect 
that your signal might just have a mean of zero.  The fft-zero frequency 
is the average of the signal.

Since the zero-frequency is dominating and equal to the average of the 
signal, the periodogram simply removes this.  The non-zero frequencies 
show up a lot better.

You will need some way of computing the mean.  I use the stats.py 
package.  You can just google search for this.

def periodogram(vector):
     mean = stats.mean(vector)
     a = FFT.fft(vector-mean)
     N = len(a)
     ab = abs(a)
     return (ab*ab)/N


More information about the Python-list mailing list