mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-11-13 22:30:54 +01:00
12 lines
356 B
Matlab
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 |