this code is basically how to graph a circle with a radius of 10
r=10;
theta = 0:0.1:360;
x=r*cosd(theta);
y=r*sind(theta);
plot(x,y,'-r')
title("circe x^2 y^2 = r^2")
xlabel("x-value")
ylabel("y-label")
legend('circle')
CodePudding user response:
You can do this:
function plotCircle(r)
theta = 0:0.1:360;
x = r*cosd(theta);
y = r*sind(theta);
plot(x,y,'-r')
title("circe x^2 y^2 = r^2")
xlabel("x-value")
ylabel("y-label")
legend('circle')
axis square
end
and call the function as plotCircle(10)
.