Statistics Toolbox | ![]() ![]() |
Syntax
Description
C = cov(X)
computes the covariance matrix. For a single vector, cov(x)
returns a scalar containing the variance. For matrices, where each row is an observation, and each column a variable, cov(X)
is the covariance matrix.
The variance function, var(X)
is the same as diag(cov(X)).
The standard deviation function, std(X)
is equivalent to sqrt(diag(cov(X)))
.
cov(x,y)
, where x
and y
are column vectors of equal length, gives the same result as cov([x y])
.
The cov
function is part of the standard MATLAB language.
Algorithm
See Also
xcov
, xcorr
(Signal Processing Toolbox)
![]() | corrcoef | crosstab | ![]() |