forked from j-petit/consensus-formation-control
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplot_error.m
67 lines (63 loc) · 2.14 KB
/
plot_error.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
% Plots error
plot_tikz = true;
% error per vehicle
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/2]);
h = plot(timeseries(squeeze(error_i.data(:,:,1:10:end)),error_i.time(1:10:end)));
% set(h(1),'LineStyle','--','Color','k');
% set(h(2),'LineStyle','-.','Color','k');
% hold on;
% hline = refline(0,0);
% hline.Color = [0.8,0.8,0.8];
% h2 = plot(timeseries(max_acc.data(1:10:end,1),max_acc.time(1:10:end)));
% set(h2,'LineStyle','-','Color','r');
xlabel('Time [s]');
ylabel('Error','Interpreter','tex');
legend('V_1','V_2','V_3','V_4','V_5','V_6','Location','Northwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('err_per_veh.tikz','width','.8\textwidth');
end;
% total error
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/2]);
h = plot(timeseries(squeeze(error_total.data(:,:,1:10:end)),error_total.time(1:10:end)));
% set(h(1),'LineStyle','--','Color','k');
% set(h(2),'LineStyle','-.','Color','k');
% hold on;
% hline = refline(0,0);
% hline.Color = [0.8,0.8,0.8];
% h2 = plot(timeseries(max_acc.data(1:10:end,1),max_acc.time(1:10:end)));
% set(h2,'LineStyle','-','Color','r');
xlabel('Time [s]');
ylabel('Error','Interpreter','tex');
legend('Total error','Location','Northwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('err_total.tikz','width','.8\textwidth');
end;
resh_err_abs_sum = [];
for i = 1:size(error_abs_sum.data,3)
resh_err_abs_sum = [resh_err_abs_sum; error_abs_sum.data(:,:,i)];
end
% total error
scrsz = get(groot,'ScreenSize');
figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/2]);
h = plot(timeseries(resh_err_abs_sum(1:10:end,:),error_abs.time(1:10:end)));
% set(h(1),'LineStyle','--','Color','k');
% set(h(2),'LineStyle','-.','Color','k');
% hold on;
% hline = refline(0,0);
% hline.Color = [0.8,0.8,0.8];
% h2 = plot(timeseries(max_acc.data(1:10:end,1),max_acc.time(1:10:end)));
% set(h2,'LineStyle','-','Color','r');
xlabel('Time [s]');
ylabel('Error','Interpreter','tex');
legend('Total error','Location','Northwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('err_abs.tikz','width','.8\textwidth');
end;