PsiLAB Help Manual Page

Section: Correlation of 2 dimensional data

Name: autocorr_2d_norm

Calculates the 2d normalized and scaled autocorrelation matrix of the real matrix a.

[ c:(float,'b,'c) Matrix.t ] = autocorr_2d_norm
a:(float,'b,'c) Matrix.t
?c:(float,'b,'c) Matrix.t

With the optional c list argument an already allocated result matrix can be given to the function.
The calculation is performed with the Fast Fourier Transform (FFT). Used algorithm method:

G(1) (a,0) = <a*a> (Maximum of Autocorrelation from matrix a)
g(1) (a,a, t) = ( G(1) (a,a, t) - (<a>*<a>)) /
(<a*a> - <a>)

The autocorrelation matrix G(1) is calculated using the FFT in the following way:

af = FFT (a,Forward)
cf = af <*> (conjmat af)
c = FFT (cf,Backward,Reorder)
c0 = c </> ( Number of matrix elements )


[] let f = fmatrix ~dim:[500;300] ~rand:[1.0] () ;; 
[] let autoc = autocorr_2d_norm f () ;; 
[] autocorr_2d_norm f ~c:[autoc] () ;; 

Printed by PsiLAB