WUT_Computer_Science/ENUME/references/numerical-methods/matlab/ad-hoc/plotCircle.m
2021-11-10 13:12:25 +01:00

12 lines
356 B
Matlab

function h = plotCircle(x, y, r)
% plot on the current focused figure
hold on
% theta makes a full circle from 0 to 2*pi radians
fraction = 50;
theta = 0 : pi / fraction : 2 * pi;
% build the x-axis and y-axis vectors of points
xs = r * cos(theta) + x;
ys = r * sin(theta) + y;
h = plot(xs, ys);
hold off
endfunction