# How can I plot a simple circle not centered at the origin? example: (x-5)^2+(y-10)^2=4

9 views (last 30 days)
cassie on 31 Jan 2014
Commented: Amit on 31 Jan 2014
example: (x-5)^2+(y-10)^2=4 I actually want to plot several overlapping circles on the same graph. I have never used matlab prior to this week so if there is a way to do this using SIMPLE function, plot, ezplot, etc. that's what I'm looking for. Thank you.
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Accepted Answer

Amit on 31 Jan 2014
Edited: Amit on 31 Jan 2014
You make a function for plotting the circle, something like this:
EDIT:
function plotcircle(x1,y1,r,c)
% x1,y1: center
% r = radius
theta = 0:0.05:2*pi;
hold on;
plot(x1+r*cos(theta),y1+r*sin(theta),c);
axis equal;
For for every circle, you can call this function: like
plotcircle(5,10,2,'r');
##### 6 CommentsShow 4 older commentsHide 4 older comments
cassie on 31 Jan 2014
I did.... plot(x+r*cos(theta),y+r*sin(theta),c)
cassie on 31 Jan 2014
I found my mistake... I didn't add the ,c at the very top. Thank you so much for your help!

Sign in to comment.

### More Answers (1)

Image Analyst on 31 Jan 2014
##### 5 CommentsShow 3 older commentsHide 3 older comments
Image Analyst on 31 Jan 2014
I didn't think you did. It's so very simple so I'm sure you thought of it independently. I just brought it up because I'm hoping the poster, or others, might also scan the other interesting stuff in there. A lot of people don't know about the existence of the FAQ, and won't unless we keep plugging it now and then.
Amit on 31 Jan 2014
I am really sorry then. I thought by 'he named the variable differently' you meant I copied the code.

Sign in to comment.

### Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!