mvnpdf says my covariance matrix is not symmetric and positive-definite. BUT IT IS!
2 views (last 30 days)
Show older comments
The matrix I'm working with is
G=[1.193220936874846 1.752209119064988 0; 1.752209119064988 2.573066480861231 0; 0 0 2.666666666666666];
and the way that I test whether a matrix is positive-definite is
[R, err] = cholcov(G, 0).
If err is 0 then it is positive-definite, but if it's > 0 then the matrix is not positive-definite.
So, given that, Matlab says that G is positive-definite but that .5*G is not! According to the link below (#2 under further properties), any scalar multiple of a positive-definite matrix is also positive-definite.
So what gives? Anybody know a way to work around this and use my matrix .5*G as the sigma argument in mvnpdf?
0 Comments
Answers (1)
Walter Roberson
on 26 Jun 2011
That same page says that in order for a matrix to be positive definite, all of the eigenvalues must be positive.
>> eig(G)
ans =
0
2.66666666666667
3.76628741773608
0 is not positive, so G is not positive definite by that definition.
To understand what is going on...
>> cond(G)
ans =
1.50674422424918e+16
That is above 1/eps so you are losing enough precision in doing the calculations as to render them suspect; different calculation routines might or might not explode for them.
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!