function dx=reactor(t,x,U,p)

ca=x(1);
cb=x(2);
V=x(3);

u=U(1);

k1=p.k1;
k2=p.k2;
cb_in=p.cb_in;


ca_dot=-k1*ca*cb-ca*u/V;
cb_dot=-k1*ca*cb-2*k2*cb^2-(cb-cb_in)*u/V;
V_dot=u;

dx=[ca_dot; cb_dot; V_dot];


end