Numerical Recipes Forum  

Go Back   Numerical Recipes Forum > Obsolete Editions Forum > Methods: Chapters 12 and 13

Reply
 
Thread Tools Display Modes
  #1  
Old 02-20-2006, 10:33 PM
Zhang Suhua Zhang Suhua is offline
Registered User
 
Join Date: Feb 2006
Location: China
Posts: 3
Question Power spectrum

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.
Reply With Quote
  #2  
Old 10-18-2006, 10:38 AM
ddsp ddsp is offline
Registered User
 
Join Date: Oct 2006
Posts: 2
Talking spctrm description

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
Reply With Quote
  #3  
Old 02-07-2007, 09:10 AM
QuantumString QuantumString is offline
Registered User
 
Join Date: Feb 2007
Posts: 2
Quote:
Originally Posted by Zhang Suhua View Post
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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:38 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.