From d1a3ce73e0648ea668e498c94ada3e1dda4f4d24 Mon Sep 17 00:00:00 2001 From: Claudio <claudio.mandrioli@control.lth.se> Date: Wed, 27 Feb 2019 10:39:03 +0100 Subject: [PATCH] moved plotting code in tradeoff experiments to separate script --- matlab/plot_tradeoff.m | 14 ++++++++++++++ matlab/run_many_cycling.m | 26 ++++++++------------------ 2 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 matlab/plot_tradeoff.m diff --git a/matlab/plot_tradeoff.m b/matlab/plot_tradeoff.m new file mode 100644 index 0000000..95645e0 --- /dev/null +++ b/matlab/plot_tradeoff.m @@ -0,0 +1,14 @@ +%% Plot data for tradeoff evaluation +%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]]; +%actual plot +figure +hold on +xlabel('energy') +ylabel('error') +title('cycling 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 diff --git a/matlab/run_many_cycling.m b/matlab/run_many_cycling.m index 6739bd4..d29e060 100644 --- a/matlab/run_many_cycling.m +++ b/matlab/run_many_cycling.m @@ -4,19 +4,18 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Load data -disp('Loads data') +disp('Load data') load('cycling_input_data'); %% Load filter settings -disp('Loads settings') +disp('Load settings') settings=get_settings_cycling(); -%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]; %nubmer of simulations per each P -n_run=30; +n_run=1; %allocate memory for output energy=zeros(n_run,length(P_treshold)); error=zeros(n_run,length(P_treshold)); @@ -33,15 +32,6 @@ for j=1:length(P_treshold) end end - -%% Plot data -figure -hold on -xlabel('energy') -ylabel('error') -title('cycling 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 -- GitLab