error using multivariate Gaussian number generator (mvnrnd)

2 views (last 30 days)
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

Accepted Answer

Peter Perkins
Peter Perkins on 6 Nov 2012
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

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices 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!