Symmetric Positive Semi-definate Covariance matrix using mvnrnd

4 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

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

Accedi per commentare.

Più risposte (1)

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

Categorie

Scopri di più su Mathematics and Optimization in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by