Borrar filtros
Borrar filtros

error using multivariate Gaussian number generator (mvnrnd)

2 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Peter Perkins
Peter Perkins el 6 de Nov. de 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

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by