The C_CORRELATE function computes the cross correlation Pxy ( L ) or cross covariance Rxy ( L ) of two sample populations X and Y as a function of the lag L .
where ` x and ` y are the means of the sample populations x = ( x 0 , x 1 , x 2 , ... , x N-1 ) and y = ( y 0 , y 1 , y 2 , ... , y N-1 ), respectively.
This routine is written in the IDL language. Its source code can be found in the file
c_correlate.pro
in the
lib
subdirectory of the IDL distribution.
Define two n-element sample populations.
X = [3.73, 3.67, 3.77, 3.83, 4.67, 5.87, 6.70, 6.97, 6.40, 5.57]
Y = [2.31, 2.76, 3.02, 3.13, 3.72, 3.88, 3.97, 4.39, 4.34, 3.95]
Compute the cross correlation of X and Y for LAG = -5, 0, 1, 5, 6, 7
A_CORRELATE , CORRELATE , M_CORRELATE , P_CORRELATE , R_CORRELATE