Code covered by the BSD License

### Highlights from Draw a circle.

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

# 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

File Information
Description

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

Acknowledgements
MATLAB release MATLAB 6.1 (R12.1)
28 Feb 2015 Stephen Cobeldick

### Stephen Cobeldick (view profile)

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

Comment only

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

Comment only
07 Aug 2014 mo

### mo (view profile)

26 Jul 2014 Geoff Stanley

### Geoff Stanley (view profile)

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

16 May 2014 Vivek

### Vivek (view profile)

04 Dec 2011 Claudio

### Claudio (view profile)

16 Aug 2011 Germán

### Germán (view profile)

A++ Will code again!!

19 May 2011 Joachim

### Joachim (view profile)

16 Feb 2011 Jason Zhang

### Jason Zhang (view profile)

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

16 Dec 2010 Jason Riesbeck

### Jason Riesbeck (view profile)

02 Jun 2010 Maosong ?

### Maosong ? (view profile)

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

21 Apr 2010 nuaa lilin

### nuaa lilin (view profile)

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

Must work with the specified starting and the ending angle.

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);
plot(r*cos(t),r*sin(t),'style')
--
also works well!

31 Jul 2007 sam s
22 Jun 2007 PONTHEP VENGSUNGNLE

Interest!
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

Comment only
14 Dec 2006 Allan Ye

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

THANKS!!!!!! :-)

24 Nov 2006 ahmed safie

no

Comment only
21 Nov 2006 Konstantinos Michalakis

Thanks!

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

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

asdfasdfasdf

22 Feb 2006 hirogatsu mifune

yokudekymashta!

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

good

12 May 2005 Sanith Wijesinghe

Great

13 Apr 2005 Bob Chen
29 Mar 2005 Joel Sander

Exactly what I was looking for...

29 Mar 2005 hugo ferreira

Nice work

www.dee.isep.ipp.pt/~e980933
www.lsa.isep.ipp.pt
www.lsa.isep.ipp.pt/~hf

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.

nice

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

fantastic

16 Jul 2003 usman usman
Comment only
24 Mar 2003 J Kile

Easy to use, does exactly what is stated