4.0

4.0 | 5 ratings Rate this file 140 downloads (last 30 days) File Size: 2.6 KB File ID: #16543

PLOT_GAUSSIAN_ELLIPSOID

by Gautam Vallabha

 

23 Sep 2007 (Updated 26 Sep 2007)

Code covered by BSD License  

Plots two- and three-dimensional Gaussian distributions

Download Now | 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 (6)
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.

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
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com