File Exchange

image thumbnail

Draw a circle.

version 1.1 (1.45 KB) by

Easy circle drawing.

4.32143
57 Ratings

23 Downloads

Updated

View License

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.

Comments and Ratings (63)

Chad Greene

Chad Greene (view profile)

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

mo (view profile)

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

Vivek (view profile)

Claudio

Germán

A++ Will code again!!

Joachim

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

Maosong ?

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

nuaa lilin

very good!

Nobody

Nobody (view profile)

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

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.

Celal

Celal (view profile)

Good solution,

julian rojas

Klaus Hansen

Muhammad Ahsan

Must work with the specified starting and the ending angle.

Joe Daady

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

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

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

very helpful

Allan Ye

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

Hendro Nurhadi

THANKS!!!!!! :-)

ahmed safie

no

Konstantinos Michalakis

Thanks!

Yasar Becerikli

Alev Soke

I am thankful for you.

Sven Mensing

Just what you need. Works perfectly

PRE Adrien

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...

John G.

Liu Jerry

Very Good function!
Many many thanks.

Ramanathan Subramanian

Daniel K.

nice

Fahad Al Mahmood

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

beno hwang

thumbs up!

phill t

fantastic

usman usman

J Kile

Easy to use, does exactly what is stated

Updates

1.1

Only the screenshot.

MATLAB Release
MATLAB 6.1 (R12.1)

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

» Watch video