Tspan=linspace(0,0.5,300);

R = 8.20578e-2;       %dm^3 atm K^-1 mol^-1
P0 = 0; %atm
T0 = 300; %K
k=1;

%for T0 = 1:100:1001
   [t u] = ode15s('diff', Tspan, [0.05 0.08 0 0 0 T0]); 
%   kvot(k) = u(300,3)./u(300,5);
%   Ptot(k) = sum(u(300,1:5)')*R.*T0;
%   k=k+1;
%end 

figure(4)
%p = R*u(:,6)'.*u(:,1:5);
P = P0 + R*u(:,6)'.*sum(u(:,1:5)');
plot(t,P)
grid
%legend('Propen','Cl_2','Allylklorid','HCl','1,2-diklorpropan','P_t_o_t')
ylabel('Tryck (atm)')

figure(5)
plot(t,u(:,6))
ylabel('Temperatur (K)')
grid

%figure(3)
%plot(0:100:1000,kvot)
%xlabel('Temperatur (K)')
%ylabel('[CH_2Cl-CHCl]/[CH_2=CH-CH_2Cl]')
%grid

%figure(2)
%plot(0:100:1000,Ptot)
%title('Totaltrycket i reaktorn (P_t_o_t)')
%xlabel('Temperatur (K)')
%ylabel('Tryck (atm)')
%grid


figure(1)
clf
plot(t,u(:,1),t,u(:,2),t,u(:,4),t,u(:,3),t,u(:,5))
legend('Propen','Cl_2','HCl','Allylklorid','1,2-diklorpropan')
xlabel('Tid (min)')
ylabel('Koncentration (M)')
grid


%figure(3)
%plot(t,u(:,6))
%ylabel('Temperatur (K)')
%grid