version 1.0.0.0 (2.09 KB) by
Nima Moshtagh

Draws 2D and 3D ellipses that are given in "center form".

Ellipse_plot(A,c)

This function draws an N-dimensional ellipse (N = 2,3) that is given in "center form":

(x - C)' A (x - C) <= 1

where C is the center of the ellipse, and A is an NxN positive definite symmetric matrix.

A and C could be the outputs of the function: "MinVolEllipse.m", which computes the minimum volume enclosing ellipsoid containing a set of points in an N-dimensional space. For example, you can use this function as follows:

P = rand(3,100);

t = 0.001;

[A , C] = MinVolEllipse(P, t)

figure

plot3(P(1,:),P(2,:),P(3,:),'*')

hold on

Ellipse_plot(A,C)

Nima Moshtagh (2021). Plot an ellipse in "center form" (https://www.mathworks.com/matlabcentral/fileexchange/13844-plot-an-ellipse-in-center-form), MATLAB Central File Exchange. Retrieved .

Created with
R13

Compatible with any release

**Inspired by:**
Minimum Volume Enclosing Ellipsoid

**Inspired:**
fakenmc/amvidc, Ellipsoid Method

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

Start Hunting!Create scripts with code, output, and formatted text in a single executable document.

Dimitrios BousiasUri CohenjackIf i multiply A with (1-epsilon) then the ellipse gets bigger which is not logical since i lower the eigen values by multiplying A with a number lower than one and if i multiply A with a number bigger than 1 then the ellipse gets smaller.

Is there a bug?

If not, can you please explain?

lanwonderful！！

Sepehr FarhandKwameCan you please show me an example of the function inputs? I keep getting errors about my inputs.

Ahmed FasihTo plot just circles with "r" radius, pass in eye(2)*(r)^-2 as the covariance matrix. A plot function like this shouldn't change the plot more than it needs to: I disabled the "grid" and "axis" commands. It should also return handles to the plot objects it creates: I had to add this as well. But this code gets me 95% there, thanks.

LIAO xjJimmyError appears when I use your function.

I found that there is another ellipsoid.m in my external toolbox.

Maybe this ellipsoid.m is called instead of that in Matlab.

So, how to solve this problem?

Nima MoshtaghHere is a link to the (unpublished) paper describing the algorithm and math behind the code:

https://sites.google.com/site/nimamoshtagh/software/MVEE.pdf?attredirects=0

Bismark NkansahGood work, Nima. I've been trying to follow the link to study the mathematical basis for the algoritm, but without success. Could you please help me?

Is it possible that in determining the minimum volume we can assign weights to the points such that the farther away a point is from the main 'cloud' the smaller its weight?

Thanks a lot.

Nima MoshtaghHere is a paper describing the "minimum volume enclosing ellipse" algorithm and the math behind the code: http://www.seas.upenn.edu/~nima/papers/Mim_vol_ellipse.pdf

Tony MeiTerrific!

Well, good programs! However, Nima, could you please show me some reference link to the mathematical basis of your algorithm ? Thanks a lot.

Santanu GhoraiEarlier I was doing only maths! But this has given me the joy of visualization.

Gergely TakacsExactly what I was searching for! Thanks!:)

david torresworks like a charm

Blake RichardsI found it quite easy to use and read.

nima moshtaghReply to John Huddleston's comment:

Function ellipsoid.m is an standard MATLAB command. It is included in version R13.

John HuddlestonThe ellipsoid.m function is missing

[X,Y,Z] = ellipsoid(0,0,0,a,b,c,N);