Code covered by the BSD License  

Highlights from
PLOT_GAUSSIAN_ELLIPSOID

4.16667

4.2 | 6 ratings Rate this file 20 Downloads (last 30 days) File Size: 2.6 KB File ID: #16543
image thumbnail

PLOT_GAUSSIAN_ELLIPSOID

by Gautam Vallabha

 

23 Sep 2007 (Updated 26 Sep 2007)

Plots two- and three-dimensional Gaussian distributions

| Watch this File

File Information
Description

PLOT_GAUSSIAN_ELLIPSOIDS plots 2-d and 3-d Gaussian distributions.
 
H = PLOT_GAUSSIAN_ELLIPSOIDS(M, C) plots the distribution specified by mean M and covariance C. The distribution is plotted as an ellipse (in 2-d) or an ellipsoid (in 3-d). By default, the distributions are plotted in the current axes. H is the graphics handle to the plotted ellipse or ellipsoid.
 
PLOT_GAUSSIAN_ELLIPSOIDS(M, C, SD) uses SD as the standard deviation along the major and minor axes (larger SD => larger ellipse). By default, SD = 1.
   
PLOT_GAUSSIAN_ELLIPSOIDS(M, C, SD, NPTS) plots the ellipse or ellipsoid with a resolution of NPTS (ellipsoids are generated on an NPTS x NPTS mesh). By default, NPTS = 50 for ellipses, and 20 for ellipsoids.
 
PLOT_GAUSSIAN_ELLIPSOIDS(M, C, SD, NPTS, AX) adds the plot to the axes specified by the axis handle AX.

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
24 Sep 2007 Ram Acharya

Put the help above the function, otherwise help cannot be displayed.

24 Sep 2007 Gautam Vallabha

"Put the help above the function, otherwise help cannot be displayed.". The help location in the m-file (below the function definition line) is a MathWorks convention. In any case, 'help plot_gaussian_ellipsoid' should work for all recent versions of MATLAB.

24 Sep 2007 John D'Errico

There is no need to move the help. It is in an entirely appropriate place.

I'll add a couple of minor comments. A standard style in matlab for functions that return graphics handles is not to return the handle if no output argument is supplied. See any function like plot, surf, etc. So why not check to see if there are any output arguments requested? If there are none, then do not return h. Thus add this test at the end of your file:

if nargout == 0
  clear h
end

It was also unclear what the "number of points" means in the ellipsoid case. Is this the number of longitudinal lines?

Good help otherwise, good error checks, H1 line, examples, etc.

12 Oct 2007 J Ugander

gca problem fixed, does what it says, well.

26 Feb 2009 Andrew Callender  
02 Apr 2009 Fejjro

Simply spectacular! Using a sphere is a good idea.

03 Jun 2011 Alex

Thanks for this one!! Works great.

Please login to add a comment or rating.
Updates
26 Sep 2007

Added nargout==0 check.
Updated help text & description.

Tag Activity for this File
Tag Applied By Date/Time
statistics Gautam Vallabha 22 Oct 2008 09:28:11
probability Gautam Vallabha 22 Oct 2008 09:28:11
gaussian Gautam Vallabha 22 Oct 2008 14:37:57
contour Gautam Vallabha 22 Oct 2008 14:37:57
normal distribution Gautam Vallabha 22 Oct 2008 14:37:57
ellipse Gautam Vallabha 22 Oct 2008 14:37:57
ellipsoid Gautam Vallabha 22 Oct 2008 14:37:57
plotting Gautam Vallabha 22 Oct 2008 14:37:57

Contact us at files@mathworks.com