I have this matrix:
S= 6.84370358358718e-006 -7.45833473076585e-007
-7.45833473076565e-007 7.11723106043725e-006
It is symmetric:
S-S'= 0 -2.00111533788828e-020
2.00111533788828e-020 0
and is positive definite:
eig(S)= 6.22219831321029e-006 and 7.73873633081414e-006
When I use [a b]=cholcov(S)
, it returns returns a=[]
and b=NaN
. It is written in MatLab help that[T,num] = cholcov(SIGMA)
... If SIGMA is not square and symmetric, num is NaN and T is empty.
Of course the chol(S)
function decomposes this function without any error. I don't know the difference between chol
and cholcov
and it is not important, since I don't have any choices. The error comes from mvnrnd(zeros(1,2),S)
function, when I try to generate some random numbers:
??? Error using ==> mvnrnd at 118
SIGMA must be a symmetric positive semi-definite matrix.
Can anyone tell me what's wrong here? thanks.