From: Mohammed Khalilia on
Peter Perkins <Peter.Perkins(a)MathRemoveThisWorks.com> wrote in message <hler3l$r3n$1(a)fred.mathworks.com>...
> On 2/16/2010 11:39 AM, Mohammed Khalilia wrote:
> > I am trying to plot in 3D a dataset generated with a mean and covariance
> > as follows:
> > mean=[8 2] ;
> > sigma=[4.1 0;0 2.8];
> > x = mvnrnd(mean,sigma,100) ;
> > [X Y]=meshgrid(x(:,1),x(:,2));
> > Z = peaks(X,Y); surf(X,Y,Z); %or mesh(X,Y,Z)
> >
> > The 3D does not look correct, since it is a Gaussian dataset, I expect a
> > nice bell shape, but what I get is more like a triangle. The elements in
> > the Z matrix almost all are zeros. So I suspect that I generated the Z
> > matrix incorrectly.
>
> If you're expecting to see something like the density of a bivariate normal distribution, then I'd have to agree. How about this:
>
> x = mvnrnd(mean,sigma,10000);
> hist3(x)
>
> or the example on this page in the documentation:
>
> <http://www.mathworks.com/access/helpdesk/help/toolbox/stats/brn2ivz-89.html>
>
> Hope this helps.

Thank you, I will give it a try.