View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Draw a circle.

4.3 | 57 ratings Rate this file 40 Downloads (last 30 days) File Size: 1.45 KB File ID: #2876 Version: 1.1
image thumbnail

Draw a circle.


Zhihua He (view profile)


20 Dec 2002 (Updated )

Easy circle drawing.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

Popular File 2010 2011

| Watch this File

File Information

Just give the center, the radius and the number of points. You can even define simple styles.


This file inspired Draw A Filled Circle, Radar Like Plot, Piccolo Particle Simulator, 2 D Mohr's Circle, Derenzo Phantom, 2 D Random Walk Confined In A Circular Domain With Reflective Boundaries, Circle3.M, Radial Scan, Plot The Angle Arc For Some Angle., Animate A Simple Mechanism, Circle Plotter, and Circlem.

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (63)
28 Feb 2015 Stephen Cobeldick

MATLAB also has inbuilt circle drawing using the |rectangle| function:

Comment only
09 Aug 2014 Chad Greene

Chad Greene (view profile)

Geoff: The functionality you seek is available in circles.m, which is described here:

Comment only
07 Aug 2014 mo

mo (view profile)

26 Jul 2014 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.

16 May 2014 Vivek

Vivek (view profile)

04 Dec 2011 Claudio

16 Aug 2011 Germán

Germán (view profile)

A++ Will code again!!

19 May 2011 Joachim

16 Feb 2011 Jason Zhang

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

16 Dec 2010 Jason Riesbeck

02 Jun 2010 Maosong ?

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

21 Apr 2010 nuaa lilin

very good!

08 Sep 2009 Nobody

Nobody (view profile)

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

08 Sep 2009 Nobody

Nobody (view profile)

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

11 Jun 2009 Celal

Celal (view profile)

Good solution,

23 Sep 2008 julian rojas

20 Aug 2008 Klaus Hansen

07 Aug 2008 Muhammad Ahsan

Must work with the specified starting and the ending angle.

04 May 2008 Joe Daady

25 Apr 2008 Ricardo Peligroso

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

05 Apr 2008 eyap candir

a missing function for matlab thanks to author

11 Sep 2007 Jao Tao Mao Ying Ling Ping Golf

Don't eat carrots.

31 Aug 2007 tom tomo

07 Aug 2007 Jens H.

t = linspace(0, 2*pi, Number_of_points);
also works well!

31 Jul 2007 sam s


Thang you sir
From thailand

31 May 2007 mohammad t moravej

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

09 May 2007 lila naseri

17 Mar 2007 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])

Comment only
06 Feb 2007 mahmoud fawzi

very helpful

Comment only
14 Dec 2006 Allan Ye

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

10 Dec 2006 Hendro Nurhadi

THANKS!!!!!! :-)

24 Nov 2006 ahmed safie


Comment only
21 Nov 2006 Konstantinos Michalakis


18 Sep 2006 Yasar Becerikli

18 Sep 2006 Alev Soke

I am thankful for you.

21 Aug 2006 Sven Mensing

Just what you need. Works perfectly

05 Jul 2006 PRE Adrien

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

03 Jul 2006 Georges Aoude

Very Useful

22 Jun 2006 LI Jia

easy to use, thanks

19 Jun 2006 Alessio Perani

Useful and functional.

03 May 2006 Nancy Wong

short but elegent

06 Mar 2006 asdasdf asdfasdf


22 Feb 2006 hirogatsu mifune


26 Jan 2006 Tom Haylo

Very simple, but very good!

31 Dec 2005 F Aries

works for me too!!!
Gee Thanx.

24 Dec 2005 Daphne Weihs

A realy nice little basis for more complex things

09 Nov 2005 Nick Cheilakos

24 May 2005 James J. Cai

It works!!

24 May 2005 shankar kumar selvaraja


12 May 2005 Sanith Wijesinghe


13 Apr 2005 Bob Chen

29 Mar 2005 Joel Sander

Exactly what I was looking for...

29 Mar 2005 hugo ferreira

Nice work

02 Feb 2005 John G.

28 Jan 2005 Liu Jerry

Very Good function!
Many many thanks.

08 Oct 2004 Ramanathan Subramanian

18 Jun 2004 Daniel K.


01 Jun 2004 Fahad Al Mahmood

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

07 May 2004 beno hwang

thumbs up!

19 Feb 2004 phill t


16 Jul 2003 usman usman

Comment only
24 Mar 2003 J Kile

Easy to use, does exactly what is stated

06 Oct 2011 1.1

Only the screenshot.

Contact us