-
Notifications
You must be signed in to change notification settings - Fork 3
/
circle_ndh.m
34 lines (30 loc) · 948 Bytes
/
circle_ndh.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function outcircle = circle_ndh(x_center,y_center,radius);
% (C) Nick Holschuh - U. of Washington - 2019 ([email protected])
% This function generates a circle for plotting with a given center
% coordinate and radius
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The inputs are as follows:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% x_center -
% y_center -
% radius -
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The outputs are as follows:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% outcircle -
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
if length(radius) == 1
radius = ones(size(x_center))*radius;
end
for i = 1:length(x_center);
th = 0:pi/50:2*pi;
xunit = radius(i) * cos(th) + x_center(i);
yunit = radius(i) * sin(th) + y_center(i);
outcircle(i).xy = [xunit' yunit'];
end
end