FUNCTION REFERENCE
mvnrnd
Multivariate normal random numbers.
Multivariate normal random numbers.
Syntax
R = mvnrnd(MU, SIGMA)Syntax
R = mvnrnd(MU, SIGMA, N)Syntax
[R, T] = mvnrnd(MU, SIGMA, N)Draws random vectors from the d-dimensional multivariate normal distribution with mean MU (1-by-d, d-by-1, or n-by-d) and covariance SIGMA (d-by-d, 1-by-d diagonal variances, or d-by-d-by-n 3-D covariance array). Returns an n-by-d matrix R = MU + randn(n, d) * T where T satisfies T' * T = SIGMA (upper-triangular Cholesky factor for strictly positive definite SIGMA, with a symmetric eigendecomposition fallback for positive semi-definite SIGMA).
Example
rng(0); mvnrnd([1 2], [2 0.5; 0.5 1], 4)Example
rng(0); [R, T] = mvnrnd([0 0], [1 1; 1 1], 3)Differences from MATLAB: draws use the session's Mersenne Twister stream (randn), so rng(seed) makes them reproducible; for rank-deficient positive semi-definite SIGMA, T is d-by-d (padded with zero rows) rather than rank-by-d.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.