Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!r28g2000vbp.googlegroups.com!not-for-mail
From: Adshak <adshaikh.hipnet@googlemail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Generating Two dimensional normal distribution
Date: Mon, 23 Feb 2009 05:08:58 -0800 (PST)
Organization: http://groups.google.com
Lines: 45
Message-ID: <594518b0-ff46-4572-a182-558969764d86@r28g2000vbp.googlegroups.com>
References: <1b67c5e2-ef95-4630-80ba-e1f897b84c14@m42g2000yqb.googlegroups.com> 
	<gnt349$kop$1@fred.mathworks.com>
NNTP-Posting-Host: 134.151.33.144
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1235394538 24184 127.0.0.1 (23 Feb 2009 13:08:58 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 23 Feb 2009 13:08:58 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: r28g2000vbp.googlegroups.com; posting-host=134.151.33.144; 
	posting-account=CERIfAoAAABmyiyq52uwdWyAPX8ZozK3
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) 
	AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.48 Safari/525.19,gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:520160

On Feb 23, 2:54=A0am, "Roger Stafford"
<ellieandrogerxy...@mindspring.com.invalid> wrote:
> Adshak <adshaikh.hip...@googlemail.com> wrote in message <1b67c5e2-ef95-4=
630-80ba-e1f897b84...@m42g2000yqb.googlegroups.com>...
> > .......
> > I am looking at functions that can help in plotting two dimensional
> > Gaussians.
> > ......
>
> What you want are 'mvnrnd' and 'mvncdf'. =A0They're also in the Statistic=
s Toolbox.
>
> Roger Stafford


Thanks so much, I have however one problem trying to use mvnpdf to
visualise the 2dimensional Gaussian or Normal Peak on a 3d plot.

So for example:

If mu =3D [0,0];
SIGMA =3D [.9 .4; .4 .3];
X=3D[-4:0.1:4];
Y=3D[-4:0.1:4];

z =3D [X;Y];

p=3Dmvnpdf(z,mu,SIG);

Now I wanted to plot a three dimensional Gaussian peak  by using
something like:

surf(X,Y,p);

But ofcourse here p needs to be a matrix which is not what I get. How
can I make p a matrix form for all possible combination of values of X
and Y, so that I can plot it using surf or mesh?

Any hint on how to achieve this, will be very beneficial to me. Can I
use meshgrid for this case? if so how?

Many thanks,

Adshak