[Pin,P1out,P3out]=importfile('mer_19_10_2016.xlsx');
%w1=[1 1 1 1 1 1 1 1 1 0 0 0 0 0];
step=4;
%w2=[0 0 0 0 0 0 0 1 1 1 1 1 1 1]
%[fitP1, gof] = createFit(Pin, P1out, w1);
%hold on;
%[fitP3, gof] = createFit(Pin, P3out, w2);
Pin2=linspace(Pin(1),20);

tt1=diff(P1out);
t1=mean(tt1(2:8))/step;
bod1=P1out(5);
q=bod1-t1*Pin(5);
fit1=t1.*Pin2+q;

tt3=diff(P3out);
t3=mean(tt3(9:13))/step;
bod3=P3out(11);
q3=bod3-t3*Pin(11);
fit3=t3.*Pin2+q3;

plot(Pin2,fit1);
hold on;
plot(Pin,P1out);
hold on;
plot(Pin2,fit3);
hold on;
plot(Pin,P3out);