søn, 11 09 2011 kl. 17:34 -0700, skrev YuHong:
> I wish to add new functions to the financial package in Octave.  The
> base is MatLab’s financial toolbox manual.  Attached is my first try
> of coding the ‘corr2cov’ function.  Basically corr2cov() calculates
> and returns covariance matrix from standard deviation and correlations
> input.  
>  
> Wish for suggestions.  Thanks a lot!

Can't you write

  ret = corr .* (sigma * sigma.');

instead of

  ret = corr;

  csize = size(corr);
  
  for i = 1:csize(1)
    for j = 1:csize(2)
      ret(i,j) *= sigma(i) * sigma(j);
    endfor
  endfor

(or something like that) ?

Søren


------------------------------------------------------------------------------
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage 
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to