Home > General-Functions > SUGR > General > Statistics > sugr_covariance_2_sigma_rho.m

sugr_covariance_2_sigma_rho

PURPOSE ^

% convert Covariance matrix into Standard deviation correlation matrix

SYNOPSIS ^

function S_rho = sugr_covariance_2_sigma_rho(C)

DESCRIPTION ^

% convert Covariance matrix into Standard deviation correlation matrix

 S_rho = sugr_covariance_2_sigma_rho(C)

 Wolfgang Förstner
 wfoerstn@uni-bonn.de

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% convert Covariance matrix into Standard deviation correlation matrix
0002 %
0003 % S_rho = sugr_covariance_2_sigma_rho(C)
0004 %
0005 % Wolfgang Förstner
0006 % wfoerstn@uni-bonn.de
0007 
0008 function S_rho = sugr_covariance_2_sigma_rho(C)
0009 
0010 n = size(C, 1);
0011 disp(['sigma_average: ', num2str(sqrt(trace(C) / n))]);
0012 sigma_average = sqrt(trace(C) / n);
0013 S_rho = zeros(n,n);
0014 for i = 1:n
0015     S_rho(i, i) = sqrt(C(i, i)) / sigma_average;
0016     for j = 1:n
0017         if i ~= j
0018             S_rho(i, j) = C(i, j) / sqrt(C(i, i) * C(j, j));
0019         end
0020     end
0021 end
0022 
0023

Generated on Sat 21-Jul-2018 20:56:10 by m2html © 2005