Power spectrum


Zhang Suhua
02-20-2006, 09:33 PM
I have read the power spectrum estimation using the fft in the chapter 13. I use the subroutine spctrm to clculate the power spectrum of Sin function, and I get the results having three peaks. It is wrong apparently. I donn't know why. In the calculation, I choose the parameters: m=1024 , k=10 and ovrlap=.true.
Can you tell me where is wrong or tell me a way to calculate the power spectrum. Thank you sincerely.

ddsp
10-18-2006, 09:38 AM
Hi guys


I am new to using spctrm and I am wondering if there is a detail description of the spctrm code on page 13 anywhere - especially a C++ version.

Cheers

QuantumString
02-07-2007, 08:10 AM
I have read the power spectrum estimation using the fft in the chapter 13. I use the subroutine spctrm to clculate the power spectrum of Sin function, and I get the results having three peaks. It is wrong apparently. I donn't know why. In the calculation, I choose the parameters: m=1024 , k=10 and ovrlap=.true.
Can you tell me where is wrong or tell me a way to calculate the power spectrum. Thank you sincerely.

To answer your question as to why this is wrong, consider the definition of "power spectral density";

Power Spectral density is a measure of the power per hertz or evergy per hertz

i.e. plotted in terms of Power Vs frequency. ( FFT transforms from time variable to frequency variable)

Outstanding peaks in your plot represents a large allocation of power/energy for that specified frequency. The FFT allows you to see just how this energy is allocated.

Now then, consider a pure Sine wave such as the one you are analysing: y(t) = sin(wt), and you want to do y(t) => y(f) by applying some form of transform.

Question: for this equation, how many frequencies are contained here? Hint: w = 2*pi*frequency (f).

If you can answer this, you should be able to tell me how many peaks you'd expect to find when you do a spectral analysis on y(t) = sin(wt). The answer is very simple from here.:) (Hint: the answer is NOT three)

The code contained in the Numerical Recipes does what it is supposed to do, so the book is not the problem. You are lacking certain fundamentals in Spectral Analysis technique. I suggest you also get a good book on this topic.