Line 1: Line 1:
 +
=MATLAB resources for generating multivariate Gaussian data=
 +
----
 
There are several ways to create multi-variate data in matlab
 
There are several ways to create multi-variate data in matlab
  
Line 54: Line 56:
 
Message-ID: <20080212230917-0500@https://engineering.purdue.edu>'''
 
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_OldKiwi]].  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
+
I worked out a proof for using the Cholsky decomposition of the covariance matrix for [[Generating Gaussian Samples_OldKiwi|Generating Gaussian Samples]].  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
 +
----
 +
[[ECE662:Homework_1_OldKiwi|Back to HW1, ECE662, Spring 2012]]
 +
 
 +
[[ECE662:BoutinSpring08_OldKiwi|Back to ECE 662 Spring 2012]]

Latest revision as of 11:50, 9 February 2012

MATLAB resources for generating multivariate Gaussian data


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_OldKiwi 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. 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


Back to HW1, ECE662, Spring 2012

Back to ECE 662 Spring 2012

Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett