For Programmers: Free Programming Magazines  


Home > Archive > Matlab > May 2005 > Converting Covariance- into Correlation Matrix









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Converting Covariance- into Correlation Matrix
philipp

2005-05-31, 4:03 am

Is there a function in Matlab that converts
Covariance matrices in Correlation matrices?
thanks
Philipp
Roger Stafford

2005-05-31, 4:03 am

In article <ef078c5.-1@webx.raydaftYaTP>, philipp
<pilleditsch@mays.tamu.edu> wrote:

> Is there a function in Matlab that converts
> Covariance matrices in Correlation matrices?
> thanks
> Philipp

------
Hello Philipp,

I don't know of any function in the general matlab repertoire that does
it, but you can compute it yourself in two lines. Let C be the covariance
matrix and R the correlation matrix. Then

t = diag(1./sqrt(diag(C)));
R = t*C*t;

should get it.

(Remove "xyzzy" and ".invalid" to send me email.)
Roger Stafford
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com