cov
Covariance
Description
returns
the covariance. C
= cov(A
)
If
A
is a vector of observations,C
is the scalar-valued variance.If
A
is a matrix whose columns represent random variables and whose rows represent observations,C
is the covariance matrix with the corresponding column variances along the diagonal.If
A
is a scalar,cov(A)
returns0
. IfA
is 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
A
andB
are vectors of observations with equal length,cov(A,B)
is the2
-by-2
covariance matrix.If
A
andB
are matrices of observations,cov(A,B)
treatsA
andB
as vectors and is equivalent tocov(A(:),B(:))
.A
andB
must be the same size.If
A
andB
are scalars,cov(A,B)
returns a2
-by-2
block of zeros. IfA
andB
are empty arrays,cov(A,B)
returns a2
-by-2
block ofNaN
.