you can use mvnrnd: Random numbers from multivariate normal distribution Syntax R = mvnrnd(mu,sigma) r = mvnrnd(mu,sigma,cases) Description R = mvnrnd(mu,sigma) returns an n-by-d matrix R of random vectors chosen from the multivariate normal distribution with mean mu, and covariance sigma. mu is an n-by-d matrix, and mvnrnd generates each row of R using the corresponding row of mu. sigma is a d-by-d symmetric positive semi-definite matrix, or a d-by-d-by-n array. If sigma is an array, mvnrnd g
may not be correct,since randn is not for multivariate distribution. furthermore, even randn generates multivariate N(0,I), the multiplier should be chol(A), not A, since the new covariance matrix for transformation y = M *x+u is M'*Sigma*M, where Sigma is x's covariance matrix.