From: Greg Heath on 29 Mar 2010 12:23 On Mar 29, 11:49 am, "James " <james.pear...(a)schneidertrading.com> wrote: > "us " <u...(a)neurol.unizh.ch> wrote in message <hoqgsr$1a...(a)fred.mathworks.com>... > > "James " <james.pear...(a)schneidertrading.com> wrote in message <hoqgbg$l2...(a)fred.mathworks.com>... > > > Hi could any one help iv created a formula in excel which iv tried > > >to re-create in Matlab but it is coming out with a different value. > > > > CovMatrix = 10x10 Matrix > > > PosVal = 10x1 Vector > > > > My forumla in excel is: > > > > VP = MMULT(CovMatrix, PosVal) > > > PortVar = MMULT(transpose(PosVal), VP) > > > > My forumla in Matlab is: > > > > VP = CovMatrix * PosVal > > > PortVar = PosVal' * VP > > > > VP on both occasions comes out the same put then when i multiply > > > this by the transpose of the PosVal this is where it seems to come > > > out different. > > > > Thanks > > > show CSSM a small input/output example... > > > us > > Here is some test data > > Matrix > > 0.00000588 0.00000044 0.00000063 0.00000027 0.00000067 > 0.00000044 0.00000009 0.00000010 0.00000006 0.00000010 > 0.00000063 0.00000010 0.00000013 0.00000007 0.00000013 > 0.00000027 0.00000006 0.00000007 0.00000005 0.00000007 > 0.00000067 0.00000010 0.00000013 0.00000007 0.00000014 > > PosVal > > 220676 -15524092 15451726 7778564 -7707771 > > Excel =: > > PortVar = 232236 > > Matlab =: > > PortVar = -507204400 >> A = [... 0.00000588 0.00000044 0.00000063 0.00000027 0.00000067 0.00000044 0.00000009 0.00000010 0.00000006 0.00000010 0.00000063 0.00000010 0.00000013 0.00000007 0.00000013 0.00000027 0.00000006 0.00000007 0.00000005 0.00000007 0.00000067 0.00000010 0.00000013 0.00000007 0.00000014 ] x = [... 220676 -15524092 15451726 7778564 -7707771 ]' Ax = A*x xtAx = x'*Ax A = 5.88e-006 4.4e-007 6.3e-007 2.7e-007 6.7e-007 4.4e-007 9e-008 1e-007 6e-008 1e-007 6.3e-007 1e-007 1.3e-007 7e-008 1.3e-007 2.7e-007 6e-008 7e-008 5e-008 7e-008 6.7e-007 1e-007 1.3e-007 7e-008 1.4e-007 x = 220676 -15524092 15451726 7778564 -7707771 Ax = 1.1376 -0.058962 0.13783 0.059142 0.06958 xtAx = 3.2198e+006 Hope this helps. Greg
First
|
Prev
|
Pages: 1 2 Prev: choosing a sphere volume within a 3D matrix Next: programmatic HC clustering suggestion? |