-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqiyuanPlot.m
More file actions
112 lines (92 loc) · 2.92 KB
/
Copy pathqiyuanPlot.m
File metadata and controls
112 lines (92 loc) · 2.92 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
close all; clear; clc;
end_point= 300;
result_parent_dir = './res06/33/';
result_dir = {
% 'atpc_agent__UGV0_20211212_194626',...
% 'MAB_map_assisted20211130_1712',...
% 'DQN_map_assisted20211130_1717',...
% 'MAB_map_assisted20211130_1715',...
% 'dqn_agent__UGV0_20211212_162946',...
% 'dqn_agent__UGV1_20211212_162946',...
% 'dqn_agent__UGV2_20211212_162946',...
% 'atpc_agent__UGV0_20211212_194626',...
% 'atpc_agent__UGV1_20211212_194626',...
% 'atpc_agent__UGV2_20211212_194626',...
'dqn_agent__UGV0_20211212_234447',...
'dqn_agent__UGV1_20211212_234447',...
'dqn_agent__UGV2_20211212_234447',...
% 'dqn_agent__UGV3_20211212_190736',...
% 'dqn_agent__UGV0_20211212_190736',...
% 'dqn_agent__UGV1_20211212_190736',...
% 'dqn_agent__UGV2_20211212_190736',...
% 'dqn_agent__UGV3_20211212_190736',...
};
result_algorithms = {
'DRL UAV1',...
'DRL UAV2',...
'DRL UAV3',...
% 'ATPC UAV1',...
% 'ATPC UAV2',...
% 'ATPC UAV3',...
};
result_number = length(result_dir);
figure_titles = {
'Delay', ...
'Power', ...
'Frame_loss', ...
'FPS', ...
};
figure_plot_data = {
'delay', ...
'power', ...
'frame_loss',...
'avgfps',...
};
figure_number = length(figure_titles);
plot_handlers = gobjects(figure_number, result_number);
double_cell = cell(1, figure_number);
[double_cell{:}] = deal('double');
T = table(...
'Size', [result_number, figure_number], ...
'VariableTypes', double_cell, ...
'VariableNames', figure_plot_data, ...
'RowNames', result_algorithms);
% move_destination_table = zeros(4,result_number);
channel_table = zeros(2,result_number);
for result_idx = 1:result_number
result_path = sprintf('%s/%s/results.mat', result_parent_dir, result_dir{result_idx});
load(result_path);
for fig_idx = 1:figure_number
delay =data_latency./(51-packet_loss);
frame_loss = packet_loss/50;
plot_data = eval(figure_plot_data{fig_idx});
plot_handlers(fig_idx, result_idx) = plot_one_figure(fig_idx, plot_data(1:end_point));
T(result_idx, fig_idx) = {mean(plot_data(1:end_point), 'all')};
end
channel_table(1,result_idx) = sum(channel == 1, 'all');
channel_table(2,result_idx) = sum(channel == 6, 'all');
end
for fig_idx = 1:figure_number
figure(fig_idx);
legend(plot_handlers(fig_idx, :), result_algorithms);
xlabel('time slot.');
ylabel(figure_titles{fig_idx});
end
figure; hold on;
bar([1,6],channel_table);
legend(result_algorithms, 'location', 'southeast');
xticks([1,6]);
xlabel('Channel');
ylabel('Switch times');
% figure; hold on;
% bar([0,2,4,6],move_destination_table);
% legend(result_algorithms, 'location', 'southeast');
% xticks([0, 2, 4 ,6]);
% xlabel('Move destination');
% ylabel('Switch times');
figure_number = figure_number + 1;
T
for fig_idx = 1:figure_number-1
figure(fig_idx);
saveas(gcf, sprintf('figures/%s.jpg',figure_plot_data{fig_idx}));
end