5.0

5.0 | 2 ratings Rate this file 82 Downloads (last 30 days) File Size: 2.04 KB File ID: #27703
image thumbnail

Draw a filled circle

by Sadik

 

23 May 2010

Plots a filled circle with given radius, center and color.

| Watch this File

File Information
Description

FILLEDCIRCLE Filled circle drawing

filledCircle(CENTER,R,N,COLOR) draws a circle filled with COLOR that has CENTER as its center and R as its radius, by using N points on the periphery.

Usage Examples,

filledCircle([1,3],3,1000,'b');
filledCircle([2,4],2,1000,'r');

If you would like to generate the screenshot image above, you could do this:

filledCircle([1,3],3,100,'k');
hold on
filledCircle([-0.25,4.25],1,100,'r');
filledCircle([2.5,3],1,100,'g');
filledCircle([0.1,1.7],1,100,'b');
axis off

Best.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Draw a circle.

MATLAB release MATLAB 7.10 (2010a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
25 Sep 2010 Tima Tima

Thank you for more simple and more useable code

15 Jan 2011 Catalin Eberhardt

Very useful, thank you!

24 Jan 2011 Catalin Eberhardt

Hi Sadik, I am having some problems using filledCircle - the first time I use the function to draw a couple of circles, they are displayed at a certain size, but then the second time (e.g. second iteration of a for loop) they are displayed slightly bigger, even though the function was called with the same RADIUS parameter. Do you know why that might be? Thanks very much!

29 Jan 2011 Sadik

Hi Catalin,

You may want to check if you are playing with the axes, especially whether or not the code is making a zooming effect.

If you can't figure that out, using the clf command of matlab, or closing and reopening the figure window at each iteration should solve the problem.

Best.

11 Mar 2012 Aziz  
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
filled circle Sadik 24 May 2010 10:55:44
fill Sadik 24 May 2010 10:55:44
color fill Sadik 24 May 2010 10:55:44
patch Sadik 24 May 2010 10:55:44

Contact us at files@mathworks.com