Is there any built-in function in MATLAB to generate a Gaussian noise with a specific covariance matrix R (colored noise), not necessarily the identity matrix (white noise)?
The really best solution would be to get rid of redundant rows of J (because why would you want the covariance of redundant variables?), so that S will bestrictly positive definite. Using the attached file,
Jr=licols(J')';
S=Jr*C*Jr';
S=(S+S')/2;
Now, even small floating point errors shouldn't produce negative eigenvalues since they are strictly bounded away from zero.
Best Answer