clear all; close all;

Th=0.85*12 %10.8

lambda0= +(-209.04)  %
lambda1= -(-0) %
lambda2= +(-0.2308) %

s_ini=-0.5*Th;
s_fin=1.5*Th;

s_inc = [s_ini:0.1:s_fin];
P_inc = lambda0 + lambda1 .* s_inc + 0.5 * lambda2.*s_inc.^2;

s = 1*Th;

P = lambda0 + lambda1*s + lambda2*s^2;
Po= lambda0;

s1_inc = [0,0]; %[0.2,0.2];
P1_inc = [0,Po];

so_inc = [0:1:Th/2];
Po_inc = lambda0 .* so_inc./so_inc;

% Ansys results OPEN I/0 FILES
n_file = 'FEAcomp_Ex403_conti_225_th_10' % nombre de la serie
fidinp = fopen([n_file,'.txt'],'r');   
results = (fscanf(fidinp,'%g %g',[2 inf]));
fclose(fidinp);
% Ansys results OPEN I/0 FILES
n_file = 'FEAcomp_Ex403_conti_225_th_100' % nombre de la serie
fidinp = fopen([n_file,'.txt'],'r');   
results2 = (fscanf(fidinp,'%g %g',[2 inf]));
fclose(fidinp);

results(1,:)=(results(1,:))*(225)
results2(1,:)=(results2(1,:))*(225)

linetxt1 = ['\leftarrow \delta_{0}= Th/100']
linetxt2 = ['\leftarrow \delta_{0}= Th/10']
linewth  = 1.5
linewth2  = 2.8

figure1 = figure
plot(s_inc,-P_inc,'k--','LineWidth',linewth)
xlabel('s [mm]','Fontsize',16);ylabel('N [N/mm]','Fontsize',16);
hold on
plot(s1_inc,-P1_inc,'k--','LineWidth',linewth)
%plot(so_inc,-Po_inc,'-.','LineWidth',1)
text(results2(2,18)+.2,results2(1,18),linetxt1,'HorizontalAlignment','left','Fontsize',16)
text(results(2,8)+.2,results(1,8),linetxt2,'HorizontalAlignment','left','Fontsize',16)
axis([s_ini s_fin 0 -min(P_inc)]) 

set(gca,'Fontsize',16);

%plot(s,-P,'rs','MarkerSize',10,'LineWidth',2)
%plot(0,-Po,'rs','MarkerSize',10,'LineWidth',2)
%plot(results(2,1:30),results(1,1:30),'k','LineWidth',linewth2)
plot( results(2,:), results(1,:),'k','LineWidth',linewth2)
plot(results2(2,:),results2(1,:),'k','LineWidth',linewth2)
hold off

saveas(figure1,['Fig4_5'],'pdf');     

