From: James on
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
From: us on
"James " <james.pearson(a)schneidertrading.com> wrote in message <hoqgbg$l27$1(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
From: Wayne King on
"James " <james.pearson(a)schneidertrading.com> wrote in message <hoqgbg$l27$1(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

Hi, can you be more specific about what you mean by "come out different". Is the difference in the two scalar outputs something that can be reasonably attributed to differences in precision, or are the answers considerably off. Perhaps, it's just the way you have the output format in Matlab?

Wayne
From: James on
"us " <us(a)neurol.unizh.ch> wrote in message <hoqgsr$1a6$1(a)fred.mathworks.com>...
> "James " <james.pearson(a)schneidertrading.com> wrote in message <hoqgbg$l27$1(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

Thanks
From: James on
"us " <us(a)neurol.unizh.ch> wrote in message <hoqgsr$1a6$1(a)fred.mathworks.com>...
> "James " <james.pearson(a)schneidertrading.com> wrote in message <hoqgbg$l27$1(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

Thanks