File Exchange

image thumbnail

Draw a circle.

version 1.1 (1.45 KB) by

Easy circle drawing.

57 Ratings



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:


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.


Vivek (view profile)



A++ Will code again!!


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 (view profile)

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


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 (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);
also works well!

sam s


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


Konstantinos Michalakis


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


hirogatsu mifune


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


Sanith Wijesinghe


Bob Chen

Joel Sander

Exactly what I was looking for...

John G.

Liu Jerry

Very Good function!
Many many thanks.

Ramanathan Subramanian

Daniel K.


Fahad Al Mahmood

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

beno hwang

thumbs up!

phill t


usman usman

J Kile

Easy to use, does exactly what is stated



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

Win prizes and improve your MATLAB skills

Play today