<< distfun_mvnpdf Multivariate Normal Negative Binomial >>

distfun >> distfun > Multivariate Normal > distfun_mvnrnd

distfun_mvnrnd

Normal random numbers

Calling Sequence

x=distfun_mvnrnd(mu,sigma)
x=distfun_mvnrnd(mu,sigma,n)

Parameters

mu :

a 1-by-d matrix of doubles, the average

sigma :

a d-by-d matrix of doubles, the covariance matrix, symmetric, positive definite

n :

a 1-by-1 matrix of floating point integers, the number of rows in x (default n=1)

x:

a n-by-d matrix of doubles, the random numbers.

Description

Generates random variables from the Multivariate Normal distribution function.

Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.

Examples

mu=[12,-31];
sigma = [
3.0  0.5
0.5  1.0
]
x=distfun_mvnrnd(mu,sigma,5);
disp(x)
n=1000;
x=distfun_mvnrnd(mu,sigma,n);
plot(x(:,1),x(:,2),"b.")
xtitle("Multivariate Normal Random Numbers","X1","X2")
mean(x,"r") // Must be close to mu
cov(x) // Must be close to sigma (requires stixbox)

Authors


Report an issue
<< distfun_mvnpdf Multivariate Normal Negative Binomial >>