version (111 KB) by AJ Johnson
Plot an error ellipse depicting confidence interval given a covariance matrix.


Updated 23 Jul 2015

View License

% ERROR_ELLIPSE - plot an error ellipse, or ellipsoid, defining
% confidence region
% ERROR_ELLIPSE(C22) - Given a 2x2 covariance matrix, plot the
% associated error ellipse, at the origin. It returns a graphics handle
% of the ellipse that was drawn.
% ERROR_ELLIPSE(C33) - Given a 3x3 covariance matrix, plot the
% associated error ellipsoid, at the origin, as well as its projections
% onto the three axes. Returns a vector of 4 graphics handles, for the
% three ellipses (in the X-Y, Y-Z, and Z-X planes, respectively) and for
% the ellipsoid.
% ERROR_ELLIPSE(C,MU) - Plot the ellipse, or ellipsoid, centered at % MU, a vector whose length should match that of C (which is 2x2
% or 3x3).
% ERROR_ELLIPSE(...,'Property1',Value1,'Name2',Value2,...) sets
% the values of specified properties, including:
% 'C' - Alternate method of specifying the covariance matrix
% 'mu' - Alternate method of specifying the ellipse (-oid) center
% 'conf' - A value betwen 0 and 1 specifying the confidence interval.
% the default is 0.5 which is the 50% error ellipse.
% 'scale' - Allow the plot the be scaled to difference units.
% 'style' - A plotting style used to format ellipses.
% 'clip' - specifies a clipping radius. Portions of the ellipse, -oid,
% outside the radius will not be shown.
% NOTES: C must be positive definite for this function to work
% properly.

Cite As

AJ Johnson (2022). error_ellipse (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R12.1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!