Advanced Analysis Library Only
AnalysisLibErrType Correlate (double arrayX[], int sizeX, double arrayY[], int sizeY, double outputArray[]);
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 This function temporarily allocates memory for use as a work area. If Correlate cannot allocate memory, the function returns an error 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);
Input | ||
Name | Type | Description |
arrayX | double-precision array | First array to compare using the correlation operation. |
sizeX | integer | Number of elements in arrayX. |
arrayY | double-precision array | Second array to compare using the correlation operation. |
sizeY | integer | Number of elements in arrayY. |
Output | ||
Name | Type | Description |
outputArray | double-precision array | Correlation array. This array must be at least (n + m — 1) elements long, where n is sizeX and m is sizeY. |
Name | Type | Description |
status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants. |