Main Content

corr2cov

Convert standard deviation and correlation to covariance

Description

example

ExpCovariance = corr2cov(ExpSigma) converts standard deviation and correlation to covariance.

example

ExpCovariance = corr2cov(___,ExpCorrC) specifies options using one or more optional arguments in addition to the input arguments in the previous syntax.

Examples

collapse all

This example shows how to convert standard deviation and correlation to covariance.

ExpSigma = [0.5  2.0];

ExpCorrC = [1.0 -0.5
           -0.5  1.0];

ExpCovariance = corr2cov(ExpSigma, ExpCorrC)
ExpCovariance = 2×2

    0.2500   -0.5000
   -0.5000    4.0000

Input Arguments

collapse all

Standard deviations of each process, specified as a vector of length n with the standard deviations of each process. n is the number of random processes.

Data Types: double

(Optional) Correlation matrix, specified as an n-by-n correlation coefficient matrix. A correlation coefficient is a statistic in which the covariance is scaled to a value between minus one (perfect negative correlation) and plus one (perfect positive correlation).

If ExpCorrC is not specified, the processes are assumed to be uncorrelated, and the identity matrix is used.

Data Types: double

Output Arguments

collapse all

Covariance matrix, returned as an n-by-n covariance matrix, where n is the number of processes.

The (i,j) entry is the expectation of the i'th fluctuation from the mean times the j'th fluctuation from the mean.

ExpCov(i,j) = ExpCorrC(i,j)*ExpSigma(i)*ExpSigma(j) 

Version History

Introduced before R2006a