LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Power Spectrum Density

Hello

I have a problem with calculating the Power Spectrum Density (PSD). Unfortunately CVI does not have this funktion. So I must calculate the function by myself.
My customer explained me the algorithm and I managed it by calling the function "AutoPowerSpectrum" with some additional calculation (see below).

We tested the program and found out, that "AutoPowerSpectrum" always calculates RMS values. My customer wants to have real amplitude values.
Can someone here explain to me, what I must change? Must I implement my own "AutoPowerSpectrum" function, or is there a way to calculate it with CVI function?

Here is my code

AutoPowerSpectrum (gBuf, 2048, dt, ps, &df);
for (i=0; i<2048; i++)
{
ps[i] = fabs(ps[i] / df);
}

wher
e
gBuf is the input array
2048 is the count of
dt is the sample period in seconds
ps is the output array (single-sided power spectrum)
df is the frequency interval, in hertz, if dt is in seconds.

Thanks in advance

Stephan Gerhards
0 Kudos
Message 1 of 2
(3,237 Views)
Stephan:
You can use the CVI AutoPowerSpectrum function, followed by the SpectrumUnitConversion function (in the Advanced Analysis Library) to convert power spectrum into peak amplitude. See the help information for SpectrumUnitConversion for details on how to use it.
0 Kudos
Message 2 of 2
(3,237 Views)