Admin Production ni-theme
Current Publication

AutoPowerSpectrum

LabWindows/CVI

AutoPowerSpectrum

Advanced Analysis Library Only

AnalysisLibErrType AutoPowerSpectrum (double inputArray[], ssize_t numberOfElements, double dt, double autoSpectrum[], double *df);

Purpose

Calculates the single-sided, scaled auto power spectrum of a time-domain signal. The auto power spectrum is defined as shown in the following figure:

where numberOfElements is the number of points in the signal array X
* denotes a complex conjugate

AutoPowerSpectrum converts the auto power spectrum to a single-sided form.

Parameters

Input
Name Type Description
inputArray double [] The time-domain signal.
numberOfElements ssize_t Number of elements in the input array.

Default Value: 1024.
dt double Sample period of the time-domain signal, usually in seconds.

dt = 1/fs, where fs is the sampling frequency of the time-domain signal.

Default Value: 1.0.
Output
Name Type Description
autoSpectrum double [] Single-sided power spectrum in volts rms squared, if the input signal is in volts. If the input signal is not in volts, the results are in input signal units rms squared. This array must be at least numberOfElements/2 elements long.
df double Points to the frequency interval, in Hertz, if dt is in seconds. df = 1/(numberOfElements × dt)

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 3.1 and later

Examples

Refer to the following examples that use the AutoPowerSpectrum function:

  • analysis\cxwindowing.cws

    Open example
  • analysis\peakest.cws

    Open example
  • analysis\thd.cws

    Open example
  • analysis\windowng.cws

    Open example