view m-toolbox/classes/+utils/@math/corr2cov.m @ 20:d58813ab1b92 database-connection-manager

Update ltpda_uo.submit
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CORR2COV
% Convert correlartion matrix to covariance matrix
% 
% SigC Vector of length n with the standard deviations of each process. n
% is the number of random processes.
% 
% CorrC n-by-n correlation coefficient matrix. If ExpCorrC is not
% specified, the processes are assumed to be uncorrelated, and the identity
% matrix is used.
% 
% Algorithm
% 
% Covar(i,j) = CorrC(i,j)*(SigmC(i)*SigmC(j) 
% 
% L Ferraioli 10-10-2010
%
% $Id: corr2cov.m,v 1.1 2010/11/16 16:41:37 luigi Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


function Covar = corr2cov(CorrC,SigC)

  Covar = CorrC;
  
  for tt=1:size(CorrC,1)
    for hh=1:size(CorrC,2)
      Covar(tt,hh) = CorrC(tt,hh)*SigC(tt)*SigC(hh);
    end
  end
end