-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathif_else.m
More file actions
31 lines (28 loc) · 844 Bytes
/
if_else.m
File metadata and controls
31 lines (28 loc) · 844 Bytes
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
% Initialize parameters out of input vector
v = [.17,.28,0,-.2,-.6];
h = v(1);
t = v(2);
theta = v(3);
dx = v(4);
dz = v(5);
% Initialize helping parameters out of input paramters
%xi = xi + dx;
eta = atan2(t,h);
a = h*cos(eta);
b = t*sin(eta);
L = 2*(a + b);
x1 = a;
x2 = a + b;
xi = linspace(0,2,10000);
%
z = zeros(1,length(xi));
for it = 1:length(xi)
n = floor(xi(it)/x2);
if mod(xi(it),x2) < x1
z(it) = xi(it)*tan(eta) - (n)*t/(cos(eta)) - h*sin(eta);
else
z(it) = -xi(it)/(tan(eta)) + (n+1)*h/(sin(eta)) - h*sin(eta);
end
end
plot(xi,z,'x');
axis equal;