Admin Production ni-theme
Current Publication

CrossPowerSpectrum

LabWindows/CVI

CrossPowerSpectrum

Advanced Analysis Library Only

AnalysisLibErrType CrossPowerSpectrum (double xArray[], double yArray[], ssize_t numberOfElements, double dt, double magnitudeSxy[], double phaseSxy[], double *df);

Purpose

Calculates the single-sided, scaled cross power spectrum of two time-domain signals. The following formula defines the cross power spectrum:

where FFT*[X] is the complex conjugate of FFT[X] and numberOfElements is the number of points in the arrays.

This function converts the cross power spectrum to single-sided magnitude and phase spectra.

Parameters

Input
Name Type Description
xArray double [] Time-domain signal X.
yArray double [] Time-domain signal Y.
numberOfElements ssize_t Number of elements in the input array.

Default Value: 1024.
dt double Sampling 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
magnitudeSxy double [] Single-sided magnitude cross power spectrum between signals XArray and YArray in volts rms square if the input signals are in volts. If the input signals are not in volts, the results are in input signal units rms square. This array must be at least numberOfElements/2 elements long.
phaseSxy double [] Single-sided phase cross spectrum in radians, showing the difference between the phases of signal YArray and signal XArray. 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