forked from j-petit/consensus-formation-control
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplot_error_spacing.m
44 lines (39 loc) · 1.38 KB
/
plot_error_spacing.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
% plot error spacing for formation keeping accuracy
% scrsz = get(groot,'ScreenSize');
% figure('OuterPosition',[scrsz(3)/2 0 scrsz(3)/2 scrsz(4)/3]);
plot_tikz = true;
figure;
h = plot(linspace(0,12,10),ones(1,10)*0.8);
set(h,'LineStyle','--','Color','k');
hold on;
h1 = plot(timeseries(spacing_mean_noOpt.data(1:10:end,:),spacing_mean_noOpt.time(1:10:end)));
%set(h1,'LineStyle','--','Color','k');
h2 = plot(timeseries(spacing_mean.data(1:10:end,:),spacing_mean.time(1:10:end)));
%set(h2,'LineStyle','-.','Color','k');
axis([0 12 0 1]);
xlabel('Time [s]');
ylabel('Mean inter vehicle distance [m]','Interpreter','tex');
legend('reference','without feedback','with feedback','Location','Southwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('spacing_mean.tikz','width','.6\textwidth');
end;
%%
% spacing for optimized per vehicle
figure;
h = plot(linspace(0,12,10),ones(1,10)*0.8);
set(h,'LineStyle','--','Color','k');
hold on;
h = plot(timeseries(spacing.data(1:10:end,:),spacing.time(1:10:end)));
% set(h(1),'LineStyle','--','Color','k');
% set(h(2),'LineStyle','-.','Color','k');
axis([0 12 0 1]);
xlabel('Time [s]');
ylabel('Inter vehicle distance [m]','Interpreter','tex');
legend('required','V_1 - V_2','V_2 - V_3','V_3 - V_4','V_4 - V_5','V_5 - V_6','Location','Southwest');
title('');
if (plot_tikz)
cleanfigure;
matlab2tikz('spacing_vehicles.tikz','width','.6\textwidth');
end;