COVM generates covariance matrix X and Y can contain missing values encoded with NaN. NaN's are skipped, NaN do not result in a NaN output. The output gives NaN only if there are insufficient input data COVM(X,Mode); calculates the (auto-)correlation matrix of X COVM(X,Y,Mode); calculates the crosscorrelation between X and Y Mode = 'M' minimum or standard mode [default] C = X'*X; or X'*Y correlation matrix Mode = 'E' extended mode C = [1 X]'*[1 X]; % l is a matching column of 1's C is additive, i.e. it can be applied to subsequent blocks and summed up afterwards the mean (or sum) is stored on the 1st row and column of C Mode = 'D' or 'D0' detrended mode the mean of X (and Y) is removed. If combined with extended mode (Mode='DE'), the mean (or sum) is stored in the 1st row and column of C. The default scaling is factor (N-1). Mode = 'D1' is the same as 'D' but uses N for scaling. C = covm(...); C is the scaled by N in Mode M and by (N-1) in mode D. [C,N] = covm(...); C is not scaled, provides the scaling factor N C./N gives the scaled version.