cov
Covariance
Description
returns
the covariance. C = cov(A)
If
Ais a vector of observations,Cis the scalar-valued variance.If
Ais a matrix whose columns represent random variables and whose rows represent observations,Cis the covariance matrix with the corresponding column variances along the diagonal.If
Ais a scalar,cov(A)returns0. IfAis an empty array,cov(A)returnsNaN.
C is normalized by the number of
observations-1. If there is only one observation, it is
normalized by 1.
returns the covariance between two random variables C = cov(A,B)A and
B.
If
AandBare vectors of observations with equal length,cov(A,B)is the2-by-2covariance matrix.If
AandBare matrices of observations,cov(A,B)treatsAandBas vectors and is equivalent tocov(A(:),B(:)).AandBmust be the same size.If
AandBare scalars,cov(A,B)returns a2-by-2block of zeros. IfAandBare empty arrays,cov(A,B)returns a2-by-2block ofNaN.