function y=diff(t,u)

% Hastighetskonstanter
k11 = 0.7;  %(dm^3/mol)^0.5 1/min
k12 = 1.0489e-35;
k21 = 0.6;  %(dm^3/mol) 1/min
k22 = 8.9908e-36;

% Reaktionshastigheter
r11 = k11*u(1)*u(2)^0.5;  
r12 = k12*u(3);
r21 = k21*u(1)^2;
r22 = k22*u(4);

figure(5)
plot(t,r21/u(1)^2,'.')
plot(t,r11/(u(1)*u(2)^0.5),'r.')
hold on

y=zeros(size(u));

y(1)=r12-r11+r22-2*r21; %HCHO
y(2)=r12/2-r11/2;       %O2
y(3)=r11-r12;           %HCOOH
y(4)=r21-r22;           %HCOOCH3

%legend('HCHO','O_2','HCOOH', 'HCOOCH3')