calculates covariance matrix
C = nan_cov(X [,Mode]); C = nan_cov(X,Y [,Mode]);
correlation matrix
[default] scales C by (N-1)
scales C by N.
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 The mean is removed from the data.
C = nan_cov(X [,Mode]); calculates the (auto-)correlation matrix of X
C = nan_cov(X,Y [,Mode]); calculates the crosscorrelation between X and Y. C(i,j) is the correlation between the i-th and jth column of X and Y, respectively.
NOTE: Octave and Matlab have (in some special cases) incompatible implemenations. This implementation follows Octave. If the result could be ambigous or incompatible, a warning will be presented in Matlab. To avoid this warning use: a) use COV([X(:),Y(:)]) if you want the traditional Matlab result. b) use C = COV([X,Y]), C = C(1:size(X,2),size(X,2)+1:size(C,2)); if you want to be compatible with this software.
http://mathworld.wolfram.com/Covariance.html