Convert covariance to standard deviation and correlation coefficient


[ExpSigma,ExpCorrC] = cov2corr(ExpCovariance)



[ExpSigma,ExpCorrC] = cov2corr(ExpCovariance) converts covariance to standard deviations and correlation coefficients.


collapse all

This example shows how to convert a covariance matrix to standard deviations and correlation coefficients.

ExpCovariance = [0.25 -0.5
                -0.5   4.0];

[ExpSigma, ExpCorrC] = cov2corr(ExpCovariance)
ExpSigma = 1×2

    0.5000    2.0000

ExpCorrC = 2×2

    1.0000   -0.5000
   -0.5000    1.0000

Input Arguments

collapse all

Covariance matrix, specified as an n-by-n covariance matrix, where n is the number of random processes. For an example, see cov or ewstats.

Data Types: double

Output Arguments

collapse all

Standard deviation of each process, returned as an 1-by-n vector.

The entries of ExpCorrC range from 1 (completely correlated) to -1 (completely anti-correlated). A value of 0 in the (i,j) entry indicates that the i'th and j'th processes are uncorrelated.

ExpSigma(i) = sqrt( ExpCovariance(i,i) );
ExpCorrC(i,j) = ExpCovariance(i,j)/( ExpSigma(i)*ExpSigma(j) );

Data Types: double

Correlation coefficients, returned as an n-by-n matrix.

Introduced before R2006a