# mvrnd - Sample from multivariate random distribution

Posted 2012.10.15 01:06

# mvnrnd

Multivariate normal random numbers

## 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 SIGMAMU is an n-by-d matrix, and mvnrnd generates each row of R using the corresponding row of muSIGMA is a d-by-dsymmetric positive semi-definite matrix, or a d-by-d-by-n array. If SIGMA is an array, mvnrndgenerates each row of R using the corresponding page of SIGMA, i.e., mvnrnd computes R(i,:)using MU(i,:) and SIGMA(:,:,i). If the covariance matrix is diagonal, containing variances along the diagonal and zero covariances off the diagonal, SIGMA may also be specified as a 1-by-d vector or a 1-by-d-by-n array, containing just the diagonal. If MU is a 1-by-d vector, mvnrndreplicates it to match the trailing dimension of SIGMA.

r = mvnrnd(MU,SIGMA,cases) returns a cases-by-d matrix R of random vectors chosen from the multivariate normal distribution with a common 1-by-d mean vector MU, and a common d-by-dcovariance matrix SIGMA.

## Examples

mu = [2 3];
SIGMA = [1 1.5; 1.5 3];
r = mvnrnd(mu,SIGMA,100);
plot(r(:,1),r(:,2),'+')

#### 'Enginius > Matlab' 카테고리의 다른 글

 Save a figure into PNG image / save to a TXT file  (0) 2012.11.17 2012.11.08 2012.10.15 2012.09.17 2012.09.03 2012.08.13
« PREV : 1 : ··· : 328 : 329 : 330 : 331 : 332 : 333 : 334 : 335 : 336 : ··· : 633 : NEXT »