Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
joint Gaussian distribution

Subject: joint Gaussian distribution

From: auda

Date: 8 Mar, 2001 16:33:05

Message: 1 of 3

Hi,
Does anyone know how to plot a 2D Gaussian envelope?

Erik

Subject: joint Gaussian distribution

From: Ghassan Hamarneh

Date: 9 Mar, 2001 03:25:06

Message: 2 of 3

try this:
surf(fspecial('gaus',40,10))

fspecial in image proc. toolbox
HTH
Ghassan

"auda" <auda@kimo.com> wrote in message news:98910e$g99$1@joe.rice.edu...
> Hi,
> Does anyone know how to plot a 2D Gaussian envelope?
>
> Erik
>
>

Subject: joint Gaussian distribution

From: Kevin Murphy

Date: 13 Mar, 2001 16:44:12

Message: 3 of 3

If you want to draw it as an ellipse...



function h=gaussplot(mu, Sigma, ncontours)
% GAUSSDRAW Plot some contours of constant probability density of a 2D
Gaussian centered o
n the mean
% h=gaussdraw(mu, Sigma, ncontours)

if ~exist('ncontours'), ncontours = -1; end

% Modelled afer demgauss from netlab.

ngrid = 50;
sx = 1*Sigma(1,1);
sy = 1*Sigma(2,2);
Xmin = mu(1)-sx; Xmax = mu(1)+sx;
Ymin = mu(2)-sy; Ymax = mu(2)+sy;
Xvals = linspace(Xmin, Xmax, ngrid);
Yvals = linspace(Ymin, Ymax, ngrid);
[X1, X2] = meshgrid(Xvals, Yvals);
XX = [X1(:), X2(:)];
% the i'th row of XX is the (x,y) coord of the i'th point in the raster
scan of the grid

probs = gauss(mu, Sigma, XX);
probs = reshape(probs, ngrid, ngrid);

if ncontours==-1
  [C,h]=contour(X1, X2, probs);
else
  [C,h]=contour(X1, X2, probs, ncontours, 'k');
end

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us