Symmetric Positive Semi-definate Covariance matrix using mvnrnd

4 次查看(过去 30 天)
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

采纳的回答

Matt J
Matt J 2012-11-18
编辑:Matt J 2012-11-18
No, the eigenvalues of SIGMA are not positive. The EIG command reveals this immediately.

更多回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Mathematics and Optimization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by