Cross Correlation

The cross correlation function is given by an overlap integral of two different shifted and unshifted profiles

CCF(tau) = integral from 0 to L of (za(x)*zb(x+tau)*dx /(square root of integral from 0 to L of square(za(x))*dx *  square root of integral from 0 to L of square(zb(x))*dx)


where

Tau is the shift distance
z(x) is surface profile
L evaluation length

or in digitized form for unbiased cross correlation

CCFj=1/(N-j)*sum from i=1 to N-j of za(i)*zb(i+j)/sqrt ( sum from i=1 to N of square(za(i)) * sum from i=1 to N of square(zb(i)))