[SciPy-user] Power spectrum scaling
Gabriel J.L. Beckers
beckers at orn.mpg.de
Fri Feb 29 04:39:25 EST 2008
Hi Keith,
I am not a signal processing guru but I think you want to divide your
magnitude spectrum by the number of samples in your FFT. Did you take
that into account? I don't know what your mean by "spectral signature",
but note that the shapes of the spectrums are not expected to be the
same if one compares a 512 sample sine and a zero-padded 1000 sample
sine.
I think you should look for more detailed help in a dsp forum. You can
trust that there is nothing wrong with how scipy calculates a fft.
Gabriel
On Thu, 2008-02-28 at 17:09 -0800, Keith Suda-Cederquist wrote:
> 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.
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
More information about the SciPy-User
mailing list