Admin Production ni-theme
Current Publication

Spectrum

LabWindows/CVI

Spectrum

Advanced Analysis Library Only

AnalysisLibErrType Spectrum (double array[], ssize_t numberOfElements);

Purpose

Calculates the power spectrum of the input array. Spectrum uses the following formula to obtain the power spectrum ps:

Spectrum performs the operation in place and overwrites the input array.

Example Code

/* Generate an array with random numbers and calculate its power spectrum. */
double x[256];
int n;
n = 256;
Uniform (n, 17, x);
Spectrum (x, n);

Parameters

Input
Name Type Description
numberOfElements ssize_t Number of elements in the input array.
Output
Name Type Description
array double [] On input, the array used to compute the power spectrum.

On output, the power spectrum.

This operation is performed in place, meaning the values in this array are overwritten.

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

Example

Refer to apps\sigproc\sigproc.cws for an example of using the Spectrum function.