-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview_data_pso.m
More file actions
64 lines (56 loc) · 2.19 KB
/
Copy pathview_data_pso.m
File metadata and controls
64 lines (56 loc) · 2.19 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
close all;
clear;
clc;
jsonData = fileread('monte_carlo_results_pso.json');
data = jsondecode(jsonData);
monte_carlo_run = length(data.optimal_values_all);
output_folder = 'Risultati';
% Migliora la leggibilità dei grafici
set(0, 'DefaultAxesFontSize', 14, 'DefaultAxesFontWeight', 'bold');
set(0, 'DefaultLineLineWidth', 2);
% Colore blu uniforme per tutti i grafici
blueColor = [0 0.447 0.741];
% %% Boxplot dei parametri ottimali
% fig = figure;
% boxplot(data.optimal_params_all, 'Labels', {'tx', 'ty', 'tz', 'theta_x', 'theta_y', 'theta_z', 'scale'}, ...
% 'Colors', blueColor);
% xlabel('Parametri', 'FontWeight', 'bold');
% ylabel('Valori Ottimali', 'FontWeight', 'bold');
% grid on;
% % saveas(fig, fullfile(output_folder, 'distribuzione_parametri_ottimali_pso.png'));
% % close(fig);
%
% %% Evoluzione dei parametri ottimali tra le simulazioni
% fig = figure;
% hold on;
% num_params = size(data.optimal_params_all, 2);
% for i = 1:num_params
% plot(data.optimal_params_all(:, i), '-o', 'LineWidth', 2, 'Color', blueColor, 'MarkerSize', 6, 'MarkerFaceColor', blueColor);
% end
% hold off;
% xlabel('Simulazione', 'FontWeight', 'bold');
% ylabel('Valore del parametro', 'FontWeight', 'bold');
% legend({'tx', 'ty', 'tz', 'theta_x', 'theta_y', 'theta_z', 'scale'}, 'Location', 'bestoutside');
% grid on;
% % saveas(fig, fullfile(output_folder, 'evoluzione_parametri_ottimali_pso.png'));
% % close(fig);
%% Grafico della fitness
fig = figure;
bar(data.optimal_values_all, 'FaceColor', blueColor);
xlabel('Run', 'FontWeight', 'bold');
ylabel('Fitness value', 'FontWeight', 'bold');
grid on;
% saveas(fig, fullfile(output_folder, 'andamento_fitness_pso.png'));
% close(fig);
%% Grafico dell'errore (RMSE)
fig = figure;
bar(data.rmse_values_all, 'FaceColor', blueColor);
xlabel('Run', 'FontWeight', 'bold');
ylabel('RMSE', 'FontWeight', 'bold');
grid on;
% saveas(fig, fullfile(output_folder, 'evoluzione_rmse_pso.png'));
% close(fig);
%% Salvataggio risultati in CSV
% results_table = table((1:monte_carlo_run)', data.optimal_values_all, data.rmse_values_all, ...
% 'VariableNames', {'Simulazione', 'ValoreFitness', 'RMSE'});
% writetable(results_table, fullfile(output_folder, 'risultati_simulazioni_pso.csv'));