File Exchange

## Draw a circle.

version 1.1.0.0 (1.45 KB) by
Easy circle drawing.

Updated 06 Oct 2011

View Version History

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.

### Cite As

Zhihua He (2020). Draw a circle. (https://www.mathworks.com/matlabcentral/fileexchange/2876-draw-a-circle), MATLAB Central File Exchange. Retrieved .

Laila Ibraheem

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

mo

Geoff Stanley

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{:});

Vivek

Claudio

Germán

A++ Will code again!!

Joachim

Jason Zhang

Matlab's built-in "rectangle" command to draw circles

Jason Riesbeck

Maosong ?

no so good, did not consider the scale between x and y

nuaa lilin

very good!

Nobody

Sorry, I see the point - you want to close the circle. Duh.

Nobody

Broken; produces repeated coordinate at the start and end position, so the centroid of the points is not the centre of the circle.

Celal

Good solution,

julian rojas

Klaus Hansen

Must work with the specified starting and the ending angle.

Ricardo Peligroso

Excellent function, couldn't believe that there wasn't a simple in-built one! Thank you! :)

eyap candir

a missing function for matlab thanks to author

Jao Tao Mao Ying Ling Ping Golf

Don't eat carrots.

tom tomo

Jens H.

---
t = linspace(0, 2*pi, Number_of_points);
plot(r*cos(t),r*sin(t),'style')
--
also works well!

sam s

PONTHEP VENGSUNGNLE

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])

lila naseri

Joerg Buchholz

Matlab's built-in "rectangle" command can draw circles if you use the curvature parameter:

rectangle ('position', [0, 0, 1, 1], curvature', [1, 1])

mahmoud fawzi

Allan Ye

Thanks, it's the one I'm after.

THANKS!!!!!! :-)

ahmed safie

no

Konstantinos Michalakis

Thanks!

Yasar Becerikli

Alev Soke

I am thankful for you.

Sven Mensing

Just what you need. Works perfectly

Great Work !
it just do the job, and well !

Georges Aoude

Very Useful

LI Jia

easy to use, thanks

Alessio Perani

Useful and functional.

Nancy Wong

short but elegent

asdasdf asdfasdf

asdfasdfasdf

hirogatsu mifune

yokudekymashta!

Tom Haylo

Very simple, but very good!

F Aries

works for me too!!!
Gee Thanx.

Daphne Weihs

A realy nice little basis for more complex things

Nick Cheilakos

James J. Cai

It works!!

shankar kumar selvaraja

good

Sanith Wijesinghe

Great

Bob Chen

Joel Sander

Exactly what I was looking for...

hugo ferreira

John G.

Liu Jerry

Very Good function!
Many many thanks.

Ramanathan Subramanian

Daniel K.

nice

Simple ... yet very smart and useful! Thanks!

beno hwang

thumbs up!

phill t

fantastic

J Kile

Easy to use, does exactly what is stated

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