Adds ellipses to the current plot
David Long (2021). ellipse.m (https://www.mathworks.com/matlabcentral/fileexchange/289-ellipse-m), MATLAB Central File Exchange. Retrieved .
Usage comments are a little confusing " ELLIPSE(ra,rb,ang,x0,y0) adds an ellipse with semimajor axis of ra, a semimajor axis of radius rb, a semimajor axis of ang"
Could you please update this?
I imagine it's something like this: " ELLIPSE(ra,rb,ang,x0,y0) adds an ellipse with semimajor axis of ra, a semiMINOR axis of radius rb, and an orientation of the semimajor axis ang, rotated counter-clockwise form the x-axis."?
I find this ellipse.m by Andrew Schwartz to be more natural to use and a few more features: https://au.mathworks.com/matlabcentral/fileexchange/25580-ellipse
Very useful code. However, I had some problem with the orientation. By subtracting the angle from pi fixed my problem.
usage notes have been corrected to address sis when's comment
I think there is something wrong with the math here. If you run the example code: ellipse(1,2,pi/8,1,1,'r'), you get an ellipse tilted downwards at 45 degrees, not upward. Also pi/8 should be 22.5 degrees, not 45 degrees.
very helpful. thank you.
can someone please explain difference between ra, rb and ang in it?
Hi David Long, is there any possibility to get a point on the ellipse that we get from your program
Hi David, Thank you - I assumed as much but thought I ought to check! Thanks.
There is a typo in the comments section. ra is the semimajor axis, rb is the semimionr axis (ra>=rb), and ang is the angle of the semimajor axis.
Could anyone clarify for me the difference between ra and rb please? The function states that "% ELLIPSE(ra,rb,ang,x0,y0) adds an ellipse with semimajor axis of ra,
% a semimajor axis of radius rb, a semimajor axis of ang, centered at
% the point x0,y0."
I assume that one or the other should be semiminor axis?
Using the pointer output ellipse as suggested in the previous comment, you can change the C argument to the standard patch command to use a vector (RGB) color. patch has some other interesting options you can use, too.
If instead of filling the ellipse with a specific color, would it be possible to fill it according to a vector?
How could that be done?
thanks. With a minor change it worked. the outputs (x, y) are cells so using patch gave me an error. I put your code in a for loop to get around the problem:
To efficiently produce a "filled" ellipse using this code, use the returned handle:
awesome code, helped me out a lot.
Do you have an efficient way in mind for "filling in" the ellipses? using patch maybe?
R2014B graphics ready
excellent! helped me a lot thank you
Congratulations for getting PoW! Great tool!
very good, very appreciate
Thanks for sharing...
excellent work, useful and well documented¡¡¡
Many thanks!! Quick and simple
Thank you very much.
Great! Thank you! Is there a quick way to make the line thickness bigger?? Cant find the obvious fix in the code.
thanks a lot
A perfect function to draw an ellipse. Thank you!
Works like a treat
nice and clean piece of code, thanks for sharing
Thank you very much!!
thanx, yours function saved my day=)
Saved my bacon today. Perfect.
thank you very much for this file. because I was looking for such a function in MatLab that can draw for me an ellipse.but if you can send me the simpleat function for drawing such a simple ellipse I will be very greatful.
Excellent- just what I needed - allows full user specification of the ellipse parameters.
Works great! Thanks a million.
Watch out for the missing semicolon in line 131. Otherwise, a great little util.
Thanks a lot!
Made my life much easier.
i like a lot. makes me happier than the other 2 guys could ever be!
It helps me a lot! Thank you very much
This function is easy to use, logical, and does exactly what it says it will. I am very happy with it.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!