error using multivariate Gaussian number generator (mvnrnd)
1 回表示 (過去 30 日間)
古いコメントを表示
Hello,
I'm trying to generate N points in a n dimension with a multivariate distribution.
I'm using the "mvnrnd" matlab funtion, however i keep getting the following error:
Error using mvnrnd (line 110) SIGMA must be a symmetric positive semi-definite matrix.
From my understanding, if the eigen values of the covariance matrix are all >= 0, then sigma is indeed positive semi-definite.
The problem is I'm getting this error even when the eigen values are all positive, and I don't know why.
I've uploaded a .mat with a mean and covariance matrix with which i get this error even though the eigen values are >0:
https://dl.dropbox.com/u/15692375/maltab_mvnrnd_example.mat
Am i overlooking something? Does anyone have idea what i'm doing wrong?
Thanks, Alex
0 件のコメント
採用された回答
Peter Perkins
2012 年 11 月 6 日
In this case, it's not the positive semi-definiteness, but the symmetry. You have relative differences that are on the order of single precision:
>> (Pp - Pp')./abs(Pp)
ans =
0 1.7455e-07 9.2053e-07
-1.7455e-07 0 2.2278e-10
-9.2053e-07 -2.2278e-10 0
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!