4.30189

4.3 | 54 ratings Rate this file 461 Downloads (last 30 days) File Size: 1.45 KB File ID: #2876
image thumbnail

Draw a circle.

by Zhihua He

 

20 Dec 2002 (Updated 06 Oct 2011)

Easy circle drawing.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

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

Acknowledgements
This submission has inspired the following:
circle3.m, Radial Scan, Plot the angle arc for some angle., Animate a Simple Mechanism, Draw a filled circle, 2D Mohr's Circle
MATLAB release MATLAB 6.1 (R12.1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (58)
24 Mar 2003 J Kile

Easy to use, does exactly what is stated

16 Jul 2003 usman usman  
19 Feb 2004 phill t

fantastic

07 May 2004 beno hwang

thumbs up!

01 Jun 2004 Fahad Al Mahmood

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

18 Jun 2004 Daniel K.

nice

08 Oct 2004 Ramanathan Subramanian  
28 Jan 2005 Liu Jerry

Very Good function!
Many many thanks.

02 Feb 2005 John G.  
29 Mar 2005 hugo ferreira

Nice work

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

29 Mar 2005 Joel Sander

Exactly what I was looking for...

13 Apr 2005 Bob Chen  
12 May 2005 Sanith Wijesinghe

Great

24 May 2005 shankar kumar selvaraja

good

24 May 2005 James J. Cai

It works!!

09 Nov 2005 Nick Cheilakos  
24 Dec 2005 Daphne Weihs

A realy nice little basis for more complex things

31 Dec 2005 F Aries

works for me too!!!
Gee Thanx.

26 Jan 2006 Tom Haylo

Very simple, but very good!

22 Feb 2006 hirogatsu mifune

yokudekymashta!

06 Mar 2006 asdasdf asdfasdf

asdfasdfasdf

03 May 2006 Nancy Wong

short but elegent

19 Jun 2006 Alessio Perani

Useful and functional.

22 Jun 2006 LI Jia

easy to use, thanks

03 Jul 2006 Georges Aoude

Very Useful

05 Jul 2006 PRE Adrien

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

21 Aug 2006 Sven Mensing

Just what you need. Works perfectly

18 Sep 2006 Alev Soke

I am thankful for you.

18 Sep 2006 Yasar Becerikli  
21 Nov 2006 Konstantinos Michalakis

Thanks!

24 Nov 2006 ahmed safie

no

10 Dec 2006 Hendro Nurhadi

THANKS!!!!!! :-)

14 Dec 2006 Allan Ye

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

06 Feb 2007 mahmoud fawzi

very helpful

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

09 May 2007 lila naseri  
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])

22 Jun 2007 PONTHEP VENGSUNGNLE

Interest!
Thang you sir
From thailand

31 Jul 2007 sam s  
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 Aug 2007 tom tomo  
11 Sep 2007 Jao Tao Mao Ying Ling Ping Golf

Don't eat carrots.

05 Apr 2008 eyap candir

a missing function for matlab thanks to author

25 Apr 2008 Ricardo Peligroso

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

04 May 2008 Joe Daady  
07 Aug 2008 Muhammad Ahsan

Must work with the specified starting and the ending angle.

20 Aug 2008 Klaus Hansen  
23 Sep 2008 julian rojas  
11 Jun 2009 Celal

Good solution,

08 Sep 2009 Nobody

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

08 Sep 2009 Nobody

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

21 Apr 2010 nuaa lilin

very good!

02 Jun 2010 Maosong ?

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

16 Dec 2010 Jason Riesbeck  
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{:});

19 May 2011 Joachim  
16 Aug 2011 German

A++ Will code again!!

04 Dec 2011 Claudio  
Please login to add a comment or rating.
Updates
06 Oct 2011

Only the screenshot.

Tag Activity for this File
Tag Applied By Date/Time
specialized Zhihua He 22 Oct 2008 06:55:16
plotting Zhihua He 22 Oct 2008 06:55:16
circle Zhihua He 22 Oct 2008 06:55:16
easy Zhihua He 22 Oct 2008 06:55:16
drawing Zhihua He 22 Oct 2008 06:55:16
radius Zhihua He 22 Oct 2008 06:55:16
styles Zhihua He 22 Oct 2008 06:55:16
specialized plot Zhihua He 22 Oct 2008 06:55:16
graphics Zhihua He 22 Oct 2008 06:55:16
potw Cristina McIntire 07 Nov 2008 13:23:52
circle Roi Harel 03 Mar 2009 12:48:11
circle seven 12 Mar 2009 07:39:25
circle Jorge 10 Jun 2009 15:11:55
circle Bastian 25 Jun 2009 05:56:37
circle Jaka Katrasnik 24 Aug 2009 09:22:08
drawing Stacy Baber 26 Aug 2009 15:56:21
circle Stacy Baber 26 Aug 2009 15:56:27
circle Marco Brugora 30 Sep 2009 06:15:41
circle Alexander 08 Oct 2009 14:03:48
easy Harmon Amakobe 26 Oct 2009 12:06:06
drawing Harmon Amakobe 26 Oct 2009 12:06:08
circle Jason Lien 16 Nov 2009 19:46:28
circle Reto Danuser 07 Dec 2009 07:33:43
circle sumeet 11 Jan 2010 13:54:07
circle Nicholas 11 Mar 2010 06:17:52
circle Mark Ringrose 11 Mar 2010 15:39:53
pyramid Abhishek D 11 Mar 2010 16:42:23
circle shakirullah 11 Apr 2010 11:13:15
circle Alexander 30 Apr 2010 05:17:24
circle Fadzarudin Anuar 03 May 2010 14:08:43
graphics Ameya 01 Jun 2010 11:17:16
circle Ameya 01 Jun 2010 12:01:01
plotting kuoping 29 Jun 2010 06:56:26
graphics Aurelius van den Berg 14 Sep 2010 06:32:37
circle Aaron cheng 08 Oct 2010 10:46:12
drawing Aaron cheng 08 Oct 2010 10:46:19
circle Oren 13 Oct 2010 13:01:23
styles Sardar 14 Oct 2010 09:11:17
styles SasiKanth 30 Jan 2011 13:39:36
pick of the week Jiro Doke 11 Feb 2011 20:18:06
circle Abdulghani HASAN 13 Feb 2011 07:16:08
circle Jason Zhang 16 Feb 2011 11:46:48
plot Jason Zhang 16 Feb 2011 11:47:00
circle Pedro 16 Mar 2011 14:43:39
circle Igor Brambor 23 Apr 2011 12:22:19
circle Rodrigo Manuel Lebrón García 27 Apr 2011 14:12:25
circle Irfan 09 May 2011 05:13:47
circle Ofer Fridman 08 Aug 2011 08:42:30
rose diagram Samba 19 Aug 2011 11:34:21
circle Patrick Grover 06 Nov 2011 12:43:54
drawing stef 12 Dec 2011 19:17:07
circle stef 12 Dec 2011 19:17:07
circle Christoph 19 Dec 2011 08:59:18
circle Ahmed findi 26 Dec 2011 23:15:59
drawing SIIT 10 Jan 2012 12:19:10
circle Adham 10 Jan 2012 21:49:50

Contact us at files@mathworks.com