This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Convert covariance to standard deviation and correlation coefficient


[ExpSigma,ExpCorrC] = cov2corr(ExpCovariance)



n-by-n covariance matrix; for example, from cov or ewstats. n is the number of random processes.


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

ExpSigma is a 1-by-n vector with the standard deviation of each process.

ExpCorrC is an n-by-n matrix of correlation coefficients.

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


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

Introduced before R2006a