The corr(vx, vy, k[, n]) function returns the correlation between two datasets using a lag size of k and an optional number of points n. For example, let f and g be two datasets. The cross correlation between the two datasets for the first N points using a lag size of k is defined as:
If f and g are identical datasets, then the result is the auto-correlation.
//when k is a scalar double corr(dataset vx, dataset vy, int k[, int n]) //when k is a vector dataset corr(dataset vx, dataset vy, dataset k[, int n])
vx
vy
k
n
Returns the correlation between two datasets using a lag size of k
The following script results in the cross correlation of the first 50 points of col(1) with col(2) using lag sizes from 1 to 10.
col(3) = corr(col(1), col(2), data(1, 10), 50);