Tspan = linspace(0,1e-6,500);

k=1;
for OH=linspace(0.019,0.0205,30)
   OH
   [t u] = ode15s('diff', Tspan, [0.01 0.01 0 OH 0]);
   H(k) = u(500,2);
   HSO4(k) = u(500,1);
   SO4(k)  = u(500,3);
   k=k+1;
end

%Haltitrerpunkten
%figure(1)
%plot(linspace(0,0.01,10)*1e3,SO4./HSO4)
%ylabel('[SO4^-^2]/[HSO_4^-]')
%xlabel('[OH^-]   (mM)')
%grid

%Titrerkurva
figure(2)
plot(linspace(0.019,0.0205,30)*1e3,-log10(H)),linspace(0,0.01,10)*1e3,15+log10(H))
xlabel('[OH^-]   (mM)')
ylabel('pH')
legend('pH','pOH')
%axis([0 22 0 14])
grid


%b)
%figure(1)
%plot(t,u)
%xlabel('Tid (s)')
%ylabel('Koncentration (M)')
%legend('HSO_4^-','H^+','SO_4^2^-','OH^-','H_2O')
%grid

%c)
%figure(2)
%plot(t,-log10(u(:,2)))
%grid
%ylabel('pH')
%xlabel('Tid (s)')


