The function below draws a circle of radius r and centered in x0,y0 and
returns its length. Complete it:
`circlef (r,x0,y0) |
I
phi=linspace (0,2*pi, 100);
x=r*cos(phi) +x0;
y=r*sin (phi)+y0; plot(x,y);
axis('equal');
length=2*pi*r;
end
i.Create it and save it as an M-file in your MATLAB folder with the name circlef.m
ii. Call it from the command window and try it with r=9, xo=0, yo=o. Circle length:
iii.hold on the plot and call the function again with r=2, x0=4, yo=4, and then
with r=2, xo=-4, yo=4, and finally with r=1, xo=0, yo=0. Sketch the resulting
plot: