clear
close all

ficres='propaCLS'
numres=1:4;

%% Legendes
legendes={};
for ii=numres
legendes{numel(legendes)+1}=num2str(ii);
end

%% Chargement
for ii=numres
load([ficres '_' num2str(ii)])
Jres(:,ii)=J;
pointeres(:,ii)=pointe';
end
F=load(['F_' ficres '.txt']);F=1000*F;
erreur=load(['erreur_' ficres '.txt']);erreur=erreur';

%% J en fonction de l'effort
figure
plot(F(2:size(Jres,1)+1),Jres(:,numres),'+-','MarkerSize',6)
ylabel('Measured J (J/m^2)','FontName','Arial','FontSize',22);
xlabel('F (N)','FontName','Arial','FontSize',22);
legend(legendes,'Location','NorthWest');
set(gca, 'Fontsize', 18)
saveas(gcf, ['JF_' ficres '.eps'], 'psc2')


%% position de la fissure en fonction de l'effort
figure
plot(F(2:size(Jres,1)+1),pointeres(:,numres),'+-','MarkerSize',6)
ylabel('Location of crack tip (pixels)','FontName','Arial','FontSize',22);
xlabel('F (N)','FontName','Arial','FontSize',22);
legend(legendes,'Location','NorthWest');
set(gca, 'Fontsize', 18)
saveas(gcf, ['pointeF_' ficres '.eps'], 'psc2')


%% erreur moyenne en fonction de l'effort
figure
plot(F(2:size(Jres,1)+1),erreur(:,numres),'+-','MarkerSize',6)
ylabel('RMS error (m)','FontName','Arial','FontSize',22);
xlabel('F (N)','FontName','Arial','FontSize',22);
legend(legendes,'Location','NorthWest');
set(gca, 'Fontsize', 18)
saveas(gcf, ['erreurF_' ficres '.eps'], 'psc2')


