# [SciPy-user] Power spectrum scaling

Keith Suda-Cederquist kdsudac@yahoo....
Thu Feb 28 19:09:12 CST 2008

```Hi All,

I'm doing some image processing and am taking the 1-D FFT of a linescan (basically I've average along one dimension of the image to get a 1-d line then take the FFT).  I then am looking at the magnitude and/or power of the spectrum.  This is straight-forward but I'm running into some problems when I try to divide my signal up
an take the FFT of the sections.

For example:

t=0.5*scipy.arange(0,1000)  #time
y=2*scipy.sin(51*t)  #arbitrary sinusoidal signal
N=1024   #I've tried this with different values of N and can't figure out how best to handle it

Y=scipy.fft(y,N)

y1=y[0:500]  #first half of signal
y2=y[500:]   #second half of singal

Y1=scipy.fft(y1,512)  #again I'm open to using different values for N
Y2=scipy.fft(y2,512)

I then do some scaling of the frequency axis to get the peaks to line up.  But I can't get the height of the peaks to be in very good agreement.

I get good agreement between the spectrums of Y1 and Y2, but not with Y.  Since I have basically a fixed frequency I'd think that the first and second halves (Y1 and Y2) of the original signal should have the same frequency characteristics
as the original (Y) and I'd just have to do some clever scaling to get the magnitude and/or power spectrums to be almost the same.  I've tried all sorts of different scaling techniques to try to get the spectral signature to be about the same but haven't had any luck.

I've scoured the weba nd looked in a fourier tranform book (by Ronald Bracewell)  I have but haven't been able to figure it out.

I think part of my problems are related to zero-padding and the difference between the number of samples.

Any signal processing gurus out there who can help me out?

Thanks,
Keith

____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080228/17e96922/attachment.html
```