There are several ways to create multi-variate data in matlab

These generate random samples from a multivariate distribution

  • You can use mvnrnd(mu,sigma) function in Matlab. (See details below)
  • You can use the technique of [Generating Gaussian Samples] (which is good theory to know).

This calculates the pdf_Old Kiwi function of the multivariate distribution

  • You can use `multigauss.m <multigauss.m>`_


From jin-young.kim.1 Tue Feb 12 11:54:56 -0500 2008 From: jin-young.kim.1 Date: Tue, 12 Feb 2008 11:54:56 -0500 Subject: How to generate multivariate normal distribution using Matlab Message-ID: <20080212115456-0500@https://engineering.purdue.edu>

=> You can use mvnrnd(mu,sigma) function in Matlab.

MVNRND Random vectors from the multivariate normal distribution. R = MVNRND(MU,SIGMA) returns an N-by-D matrix R of random vectors chosen from the multivariate normal distribution with mean vector MU, and covariance matrix 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 generates each row of R using the corresponding page of SIGMA, i.e., MVNRND computes R(I,:) using MU(I,:) and SIGMA(:,:,I). If MU is a 1-by-D vector, MVNRND replicates it to match the trailing dimension of SIGMA.

R = MVNRND(MU,SIGMA,N) returns a N-by-D matrix R of random vectors chosen from the multivariate normal distribution with 1-by-D mean vector MU, and D-by-D covariance matrix SIGMA.

Example: mu = [1 -1]; Sigma = [.9 .4; .4 .3]; r = mvnrnd(mu, Sigma, 500); plot(r(:,1),r(:,2),'.');

See also mvtrnd, mvnpdf, mvncdf, normrnd.

Reference page in Help browser doc mvnrnd

Ref: Matlab Help

Here is another way to do so (probably what mvnrnd.m is doing in the first place): GeneratingGaussianSamples

From landis.m.huffman.1 Tue Feb 12 23:09:17 -0500 2008 From: landis.m.huffman.1 Date: Tue, 12 Feb 2008 23:09:17 -0500 Subject: Generating Gaussian Samples Message-ID: <20080212230917-0500@https://engineering.purdue.edu>

I worked out a proof for using the Cholsky decomposition of the covariance matrix for Generating Gaussian Samples_Old Kiwi. I suppose you could use this if you were not going to use Matlab, which, as I have found here, already has a canned function for this type of sampling

Alumni Liaison

Recent Math PhD now doing a post-doctorate at UC Riverside.

Kuei-Nuan Lin