T=12;
trange=[0 T];
cs0 = [0; 1; 1; 0];
[t,unknown]=ode45(@reaction,trange,cs0);
c = unknown(:, 1);
s = unknown(:, 2);
e = unknown(:, 3);
p = unknown(:, 4);
[c_max, idx_c_max] = max(c);
t_c_max = t(idx_c_max);
[e_min, idx_e_min] = min(e);
t_e_min = t(idx_e_min);
hold on
plot(t,c,'m',t,s,'c',t,e,'r',t,p,'k')
plot(t_c_max, c_max, 'm+', t_e_min, e_min, 'r+');
ylim([0 1.1])
xlabel('time, t')
ylabel('concentration')
legend({' enzyme-substrate complex concentration',' substrate concentration',' enzyme concentration ',' product concentration'}, "Location","best")
function dydt = reaction(~, cse)
k1 = 6;
k2 = 1;
kminus1 = 2;
reaction=zeros(4,1);
reaction(1) = k1*cse(2)*cse(3)-kminus1*cse(1)-k2*cse(1);
reaction(2) = -k1*cse(2)*cse(3)+kminus1*cse(1);
reaction(3) = -k1*cse(2)*cse(3)+kminus1*cse(1)+k2*cse(1);
reaction(4) = k2*cse(1);
dydt=[reaction(1); reaction(2); reaction(3); reaction(4)];
end
Best Answer