Admin Production ni-theme
Current Publication

Correlate

LabWindows/CVI

Correlate

Advanced Analysis Library Only

AnalysisLibErrType Correlate (double arrayX[], ssize_t sizeOfX, double arrayY[], ssize_t sizeOfY, double outputArray[]);

Purpose

Note Note  This function has been superseded by CorrelateEx. CorrelateEx includes an additional parameter, which makes it more versatile than Correlate.

Finds the correlation of the input arrays. Correlate obtains the correlation using the following formula:

yi = 0 when j < 0 or j ≥ m

xi = 0 when j < 0 or j ≥ n

Note Note  This function temporarily allocates memory for use as a work area. If Correlate cannot allocate memory, the function returns an error code.

Example Code

/* Generate two arrays with random numbers and find their correlation. *\/
double x[256], y[256], cxy[512];
int n, m;
n = 256;
m = 256;
Uniform (n, 17, x);
Uniform (m, 17, y);
Correlate (x, n, y, m, cxy);

Parameters

Input
Name Type Description
arrayX double [] First array to compare using the correlation operation.
sizeOfX ssize_t Number of elements in arrayX.
arrayY double [] Second array to compare using the correlation operation.
sizeOfY ssize_t Number of elements in arrayY.
Output
Name Type Description
outputArray double [] Correlation array.

This array must be at least (n + m – 1) elements long, where n is sizeX and m is sizeY.

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 Correlate function:

  • analysis\correlat.cws

    Open example
  • analysis\phasedif.cws

    Open example