Signal Processing Toolbox    
cov

Compute the covariance matrix.

Syntax

Description

cov computes the covariance matrix. If x is a vector, c is a scalar containing the variance. For an array where each row is an observation and each column a variable, cov(X) is the covariance matrix. diag(cov(X)) is a vector of variances for each column, and sqrt(diag(cov(X))) is a vector of standard deviations.

cov(x) is the zeroth lag of the covariance function, that is, the zeroth lag of
xcov(x)/(n-1) packed into a square array.

cov(x,y) where x and y are column vectors of equal length is equivalent to cov([x y])), that is, it concatenates x and y in the row direction before its computation.

cov removes the mean from each column before calculating the results.

The cov function is part of the standard MATLAB language.

Algorithm

See Also
corrcoef
Correlation coefficient matrix.
mean
Average value (see the MATLAB documentation).
median
Median value (see the MATLAB documentation).
std
Standard deviation (see the MATLAB documentation).
xcorr
Cross-correlation function estimate.
xcov
Cross-covariance function estimate (equal to mean-removed cross-correlation).


 corrmtx cplxpair