4.30909

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

Draw a circle.

by

 

20 Dec 2002 (Updated )

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 file inspired Draw A Filled Circle, Radar Like Plot, Piccolo Particle Simulator, 2 D Mohr's Circle, Derenzo Phantom, Circle3.M, Radial Scan, Plot The Angle Arc For Some Angle., Animate A Simple Mechanism, and Circle Plotter.

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 (60)
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.
H=plot(X,Y,varargin{:});

16 May 2014 Vivek  
04 Dec 2011 Claudio  
16 Aug 2011 German

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

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

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.

11 Jun 2009 Celal

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

06 Feb 2007 mahmoud fawzi

very helpful

14 Dec 2006 Allan Ye

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

10 Dec 2006 Hendro Nurhadi

THANKS!!!!!! :-)

24 Nov 2006 ahmed safie

no

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

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

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  
24 Mar 2003 J Kile

Easy to use, does exactly what is stated

Updates
06 Oct 2011

Only the screenshot.

Contact us