Symmetric Positive Semi-definate Covariance matrix using mvnrnd

1 view (last 30 days)
I'm having an issue using mvnrnd. My covariance matrix is,
SIGMA = [12.96 14.076 0 0 0 0 0 0 0 0 0 0; 14.076 21.16 21.114 0 0 0 0 0 0 0 0 0; 0 21.114 29.16 27.54 0 0 0 0 0 0 0 0; 0 0 27.54 36 25.5 0 0 0 0 0 0 0; 0 0 0 25.5 25 17 0 0 0 0 0 0; 0 0 0 0 17 16 12.24 0 0 0 0 0; 0 0 0 0 0 12.24 12.96 9.792 0 0 0 0; 0 0 0 0 0 0 9.792 10.24 8.16 0 0 0; 0 0 0 0 0 0 0 8.16 9 8.415 0 0; 0 0 0 0 0 0 0 0 8.415 10.89 16.83 0; 0 0 0 0 0 0 0 0 0 16.83 36 28.05; 0 0 0 0 0 0 0 0 0 0 28.05 30.25]
All my eigenvalues are positive, and the matrix is symmetric, as far as I can tell, yet whenever I attempt to generate my RV's:
clear clc SIGMA = [12.96 14.076 0 0 0 0 0 0 0 0 0 0; 14.076 21.16 21.114 0 0 0 0 0 0 0 0 0; 0 21.114 29.16 27.54 0 0 0 0 0 0 0 0; 0 0 27.54 36 25.5 0 0 0 0 0 0 0; 0 0 0 25.5 25 17 0 0 0 0 0 0; 0 0 0 0 17 16 12.24 0 0 0 0 0; 0 0 0 0 0 12.24 12.96 9.792 0 0 0 0; 0 0 0 0 0 0 9.792 10.24 8.16 0 0 0; 0 0 0 0 0 0 0 8.16 9 8.415 0 0; 0 0 0 0 0 0 0 0 8.415 10.89 16.83 0; 0 0 0 0 0 0 0 0 0 16.83 36 28.05; 0 0 0 0 0 0 0 0 0 0 28.05 30.25] mu = [.9 2.3 5 12.5 8.8 -2 -4.3 -2.5 -1.5 .2 3.8 4.3] r = mvnrnd(mu, SIGMA, 2000)
I receive this error message.
??? Error using ==> mvnrnd at 118 SIGMA must be a symmetric positive semi-definite matrix.
Thanks for the help! David

Accepted Answer

Matt J
Matt J on 18 Nov 2012
Edited: Matt J on 18 Nov 2012
No, the eigenvalues of SIGMA are not positive. The EIG command reveals this immediately.
  1 Comment
David Young
David Young on 19 Nov 2012
Thanks for your help!
If you saw my prev comment, I found the answer to my follow up question.

Sign in to comment.

More Answers (1)

Jurgen
Jurgen on 18 Nov 2012
isequal(sum(eig(SIGMA)>0),length(eig(SIGMA)))
Why does eig(SIGMA) give negative eigenvalues?

Categories

Find more on Eigenvalues & Eigenvectors in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!