From 6e6be874dfaa8d1a51e0db3e54acb06bc5a6d6dc Mon Sep 17 00:00:00 2001
From: Claudio <claudio.mandrioli@control.lth.se>
Date: Wed, 27 Feb 2019 10:53:23 +0100
Subject: [PATCH] polished and modified trade off experiments script for car so
 that it uses the plotting script

---
 matlab/plot_tradeoff.m    |  2 +-
 matlab/run_many_car.m     | 45 +++++++++++++++------------------------
 matlab/run_many_cycling.m |  6 +++---
 3 files changed, 21 insertions(+), 32 deletions(-)

diff --git a/matlab/plot_tradeoff.m b/matlab/plot_tradeoff.m
index b2560c3..dc74092 100644
--- a/matlab/plot_tradeoff.m
+++ b/matlab/plot_tradeoff.m
@@ -6,7 +6,7 @@ figure
 hold on
 xlabel('energy')
 ylabel('error')
-title('cycling energy accuracy tracking trade-off')
+title('energy accuracy tracking trade-off')
 grid
 %iterate and plot the results for the different P thresholds
 for j=1:length(P_treshold)
diff --git a/matlab/run_many_car.m b/matlab/run_many_car.m
index af2d2c9..545888d 100644
--- a/matlab/run_many_car.m
+++ b/matlab/run_many_car.m
@@ -1,48 +1,37 @@
-%"monteCarlo" example
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Script for example of energy-accuracy trade-off evaluatio with the
+% car trace
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 %% Load data
 disp('Loads data')
-load('GNSSaidedINS_data.mat');
+load('car_input_data.mat');
 
 %% Load filter settings
 disp('Loads settings')
 settings=get_settings_car();
 
-%vector of RGB colors for plotting for the different P references
-color=[[0.7,0.0,0.0];[0.0,0.7,0.0];[0.7,0.0,0.7];[0.0,0.0,0.7];[0.0,0.7,0.7];[0.7,0.7,0.0]];
+%% Settings for tradeoff evaluation
 %vector of refrences for P
-P_treshold=[4.0,5.0,6.0,8.0,10.0,12.0];
+P_treshold=[4.0];%,5.0,6.0,8.0,10.0,12.0];
 %number of runs per each P
 n_run=1;
 %allocate memory for output
 energy=zeros(n_run,length(P_treshold));
 error=zeros(n_run,length(P_treshold));
 
+%% Iterate over the different thresholds for tr(P)
 for j=1:length(P_treshold)
-    %set P reference
+    disp(['Starting simulations with threshold for P equal to:', num2str(P_treshold(j))]) %display reached treshold
     settings.P_treshold=P_treshold(j);
-    %run simulations
-    for k=1:n_run
-        %% Run the GNSS-aided INS
-        disp('Running the GNSS-aided INS')
-        P_treshold(j)
-        k
-        out_data=GPSaidedINS(in_data,settings);
-        energy(k,j)=out_data.energy;
-        error(k,j)=out_data.error;
+    for k=1:n_run                                        %iterate over the number of simulations per threshold
+        disp(['Simulation number:',num2str(k)])          %display simulation number
+        out_data=GPSaidedINS_car(in_data,settings);  % Run the GNSS-aided INS
+        energy(k,j)=out_data.energy;                     % store energy
+        error(k,j)=out_data.error;                       % store positioning error
     end
 end
 
-
-%plot data
-disp('Plotting data:')
-figure
-hold on
-xlabel('energy')
-ylabel('error')
-title('car energy accuracy tracking trade-off')
-grid
-
-for j=1:length(P_treshold)
-    scatter(energy(:,j), error(:,j),20,color(j,:),'o','filled')
-end
\ No newline at end of file
+%% Plot results
+disp('Plot results')
+plot_tradeoff
\ No newline at end of file
diff --git a/matlab/run_many_cycling.m b/matlab/run_many_cycling.m
index d98bbb1..b506730 100644
--- a/matlab/run_many_cycling.m
+++ b/matlab/run_many_cycling.m
@@ -13,14 +13,14 @@ settings=get_settings_cycling();
 
 %% Settings for tradeoff evaluation
 %vector of refrences for P
-P_treshold=[4.0,5.0];%,6.0,8.0,10.0,12.0];
+P_treshold=[4.0,5.0,6.0,8.0,10.0,12.0];
 %nubmer of simulations per each P
-n_run=1;
+n_run=50;
 %allocate memory for output
 energy=zeros(n_run,length(P_treshold));
 error=zeros(n_run,length(P_treshold));
 
-%% Iterate over the threshold for tr(P)
+%% Iterate over the different thresholds for tr(P)
 for j=1:length(P_treshold)   
     disp(['Starting simulations with threshold for P equal to:', num2str(P_treshold(j))]) %display reached treshold
     settings.P_treshold=P_treshold(j);                   %set P reference
-- 
GitLab