-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_ref_trajectory.m
50 lines (41 loc) · 972 Bytes
/
get_ref_trajectory.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
%% multi- trjectory
function theta_r = get_ref_trajectory()
dt=0.001;
t = 0:dt:5;
theta_r = zeros(2,length(t));
i=1;
for t=0:dt:1
theta_r(1,i) = 1;
theta_r(2,:) = 1.5;
i = i+1;
end
for t=0+dt:dt:1
theta_r(1,i) = theta_r(1,length(0:dt:1-dt)) + 0.5*t;
theta_r(2,i) = theta_r(2,length(0:dt:1-dt)) - t;
i=i+1;
end
for t=0+dt:dt:1
theta_r(1,i) = theta_r(1,i-1);
theta_r(2,i) = theta_r(2,i-1);
i = i+1;
end
for t=0+dt:dt:1
theta_r(1,i) = theta_r(1,length(0:dt:3-dt)) - t;
theta_r(2,i) = theta_r(2,length(0:dt:3-dt)) + 0.5*t;
i=i+1;
end
for t=0+dt:dt:1
theta_r(1,i) = theta_r(1,i-1);
theta_r(2,i) = theta_r(2,i-1);
i=i+1;
end
%{
t=0:dt:5;
figure;
plot(t,theta_r);
ylim([0 2])
grid on;
legend('theta1','theta2');
xlabel('t'); ylabel('$\theta_1, \theta_2(rad)$','Interpreter','Latex');
%}
end