Editor's Note: This file was selected as MATLAB Central Pick of the Week Popular File 2010 2011
Just give the center, the radius and the number of points. You can even define simple styles.
Zhihua He (2021). Draw a circle. (https://www.mathworks.com/matlabcentral/fileexchange/2876-draw-a-circle), MATLAB Central File Exchange. Retrieved .
Inspired: circlem, circle_matrix(image,radius, center, value, thickness), circle3.m, Radial Scan, Plot the angle arc for some angle., Animate a Simple Mechanism, Draw a filled circle, 2D Mohr's Circle, circle plotter, Radar-like Plot, Piccolo Particle Simulator, Derenzo phantom, 2D random walk confined in a circular domain with reflective boundaries
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.
MATLAB also has inbuilt circle drawing using the |rectangle| function:
http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F
http://www.mathworks.com/help/matlab/ref/rectangle.html
Geoff: The functionality you seek is available in circles.m, which is described here: http://www.mathworks.com/matlabcentral/fileexchange/45952-circle-plotter/content/circles_demo/html/circles_documentation.html
Slightly easier than
hc = circle(...);
set(hc, 'Property', value)
would be to change, in circle.m, the 'style' argument to 'varargin', and pass all those additional arguments straight to plot, ie.
H=plot(X,Y,varargin{:});
A++ Will code again!!
Matlab's built-in "rectangle" command to draw circles
function circle (x,y,radius,varargin)
rectangle('position',[x-radius, y-radius, 2*radius, 2*radius],'curvature',[1 1],varargin{:});
no so good, did not consider the scale between x and y
very good!
Sorry, I see the point - you want to close the circle. Duh.
Broken; produces repeated coordinate at the start and end position, so the centroid of the points is not the centre of the circle.
Good solution,
Must work with the specified starting and the ending angle.
Excellent function, couldn't believe that there wasn't a simple in-built one! Thank you! :)
a missing function for matlab thanks to author
Don't eat carrots.
---
t = linspace(0, 2*pi, Number_of_points);
plot(r*cos(t),r*sin(t),'style')
--
also works well!
Interest!
Thang you sir
From thailand
nice usage of the pol2cart command.
if one is to use rectangle command to draw a circle,it should be noticed that the axis aspect ratios also should be set to equal ratiots or the circle plot will seem an ellipse.(use daspect([1 1 1])
Matlab's built-in "rectangle" command can draw circles if you use the curvature parameter:
rectangle ('position', [0, 0, 1, 1], curvature', [1, 1])
very helpful
Thanks, it's the one I'm after.
THANKS!!!!!! :-)
no
Thanks!
I am thankful for you.
Just what you need. Works perfectly
Great Work !
it just do the job, and well !
Very Useful
easy to use, thanks
Useful and functional.
short but elegent
asdfasdfasdf
yokudekymashta!
Very simple, but very good!
works for me too!!!
Gee Thanx.
A realy nice little basis for more complex things
It works!!
good
Great
Exactly what I was looking for...
Nice work
www.dee.isep.ipp.pt/~e980933
www.lsa.isep.ipp.pt
www.lsa.isep.ipp.pt/~hf
Very Good function!
Many many thanks.
nice
Simple ... yet very smart and useful! Thanks!
thumbs up!
fantastic
Easy to use, does exactly what is stated