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
0 件のコメント
採用された回答
その他の回答 (1 件)
Jurgen
2012 年 11 月 18 日
isequal(sum(eig(SIGMA)>0),length(eig(SIGMA)))
Why does eig(SIGMA) give negative eigenvalues?
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Mathematics and Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!