-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotResults.m
48 lines (43 loc) · 1.17 KB
/
plotResults.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
%% PLOT SIMULATION RESULTS
linewidth = 6;
fontsize = 30;
lgdFontsize = 40;
t = linspace(0, T, nSamples)';
%% Error plot
figure
hold on
grid on
plot(t,abs(repmat(q_ref(1),length(t),1) - xHistory(:,1)));
plot(t,abs(repmat(q_ref(2),length(t),1) - xHistory(:,2)));
xlabel('[s]')
ylabel('[rad]')
lgd = legend('$|e_1|$', '$|e_2|$', 'Interpreter', 'latex', 'Location', 'best');
title('Links position error')
set(findall(gcf,'type','line'),'linewidth',linewidth);
set(gca,'FontSize',fontsize);
lgd.FontSize = lgdFontsize;
%% Torque plot
figure
hold on
grid on
plot(t,uHistory(:,1))
plot(t,uHistory(:,2))
xlabel('[s]')
ylabel('[Nm]')
lgd = legend('$\tau_1$', '$\tau_2$', 'Interpreter', 'latex', 'Location', 'best');
title('Controlled torque')
set(findall(gcf,'type','line'),'linewidth',linewidth);
set(gca,'FontSize',fontsize);
lgd.FontSize = lgdFontsize;
%% GP error plot
% figure
% hold on
% grid on
% t = linspace(0,10, size(eHistory, 1));
% plot(t,eHistory(:,1));
% xlabel('Re-training step')
% lgd = legend('error', 'Location', 'best');
% title('Norm of prediction error')
% set(findall(gcf,'type','line'),'linewidth',linewidth);
% set(gca,'FontSize',fontsize);
% lgd.FontSize = lgdFontsize;