Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

CNiMath::CrossSpectrum() programming experience?

According to NiMath.h in-line comment, this function "calculates the double-sided cross power spectrum of two time-domain signals." Parameter 1 and 2 are time-domain signals as inputs. Upon return, the third parameter should contain the double-sided cross power spectrum between the two time-domain signals, in a complex form.

 

Looking at the real part, I am surprised that it contains some negative values. Can "power spectrum" be negative? Would appreciate anyone sharing your experience. Further questions:

1.  Do I need to scale the two time-domain signals?

2.  Why this function does take sampling rate into concern?

3.  There is another similar API, CNiMath::CrossPowerSpectrum(), which takes sampling frequency into account. What are the guideline while comes to decide which API to use?

 

Thanks again for your generous sharing of programming experience.

0 Kudos
Message 1 of 2
(4,869 Views)

Hello year2070, 

 

CrossSpectrum() calculates the doubled-sided cross power spectrum, while CrossPowerSpectrum() calculates the single-sided form. Which you use is dependent on what information you're seeking to obtain. The following document goes into more detail about the differences between the two. 

 

http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/libref/analysisconcepts/cross_power_spect/

0 Kudos
Message 2 of 2
(4,856 Views)