comparison m-toolbox/classes/+utils/@math/corr2cov.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % CORR2COV
3 % Convert correlartion matrix to covariance matrix
4 %
5 % SigC Vector of length n with the standard deviations of each process. n
6 % is the number of random processes.
7 %
8 % CorrC n-by-n correlation coefficient matrix. If ExpCorrC is not
9 % specified, the processes are assumed to be uncorrelated, and the identity
10 % matrix is used.
11 %
12 % Algorithm
13 %
14 % Covar(i,j) = CorrC(i,j)*(SigmC(i)*SigmC(j)
15 %
16 % L Ferraioli 10-10-2010
17 %
18 % $Id: corr2cov.m,v 1.1 2010/11/16 16:41:37 luigi Exp $
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20
21
22 function Covar = corr2cov(CorrC,SigC)
23
24 Covar = CorrC;
25
26 for tt=1:size(CorrC,1)
27 for hh=1:size(CorrC,2)
28 Covar(tt,hh) = CorrC(tt,hh)*SigC(tt)*SigC(hh);
29 end
30 end
31 end