Home > freetb4matlab > NaN > cov.m

cov

PURPOSE ^

COV covariance matrix

SYNOPSIS ^

function CC = cov(X,Y,Mode);

DESCRIPTION ^

 COV 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
 The mean is removed from the data. 

 C = COV(X [,Mode]);
      calculates the (auto-)correlation matrix of X
 C = 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.  

 Mode = 0 [default] scales C by (N-1)
 Mode = 1 scales C by N. 

 see also: COVM, COR, CORRCOEF, SUMSKIPNAN

 REFERENCES:
 http://mathworld.wolfram.com/Covariance.html

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Fri 22-May-2009 15:13:00 by m2html © 2003