MATLAB: Need a script to plot a circle with given radius and center

circle radiusgraphic

I need some help guys! Need a script to plot a circle with center(5,7) and radius 3. I have these:
clear clc
r=3;
t=0:pi/24:2*pi;
x=r*cos(t);
y=r*sin(t);
plot(x,y,x,y)
grid on
But only the radius works.. help please.

Best Answer

Here's one way from the FAQ that is most similar to yours:
xCenter = 5;
yCenter = 7;
theta = 0 : 0.01 : 2*pi;
radius = 3;
x = radius * cos(theta) + xCenter;
y = radius * sin(theta) + yCenter;
plot(x, y);
axis square;
xlim([0 10]);
ylim([0 12]);
grid on;
axis equal;