Finding min and max of ODEs
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
The task was to model an enzymatic reaction which I did with the written code. The obtained plot and the equations are in the attached picture. I need to find the the time when the enzyme concentration is minimal and enzyme-substrate concentration maximal. I know that the concentration change in the minimum/maximum should be zero ( d[E]/dt=d[C]/dt=0 ) but I don't know how I would write the code to find the time.
function dydt = reaction(~, cse)
% Defining reaction parameters:
k1 = 6;
k2 = 1;
kminus1 = 2;
% Defining reactions
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
_____
% defining the time range:
T=12;
trange=[0 T];
% defining initial values (concentrations) for c,s,e i p:
cs0 = [0; 1; 1; 0];
% [t,x] = ode45(@reaction, trange, initial values)
[t,unknown]=ode45(@reaction,trange,cs0);
c = unknown(:, 1);
s = unknown(:, 2);
e = unknown(:, 3);
p = unknown(:, 4);
% plot drawing
plot(t,c,'m',t,s,'c',t,e,'r',t,p,'k')
ylim([0 1.1])
xlabel('time, t')
ylabel('concentration')
legend({' enzyme-substrate complex concentration',' substrate concentration',' enzyme concentration ',' product concentration'}, "Location","best")
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 4 Jul. 2020
Bearbeitet: Ameer Hamza
am 4 Jul. 2020
See this example
% defining the time range:
T=12;
trange=[0 T];
% defining initial values (concentrations) for c,s,e i p:
cs0 = [0; 1; 1; 0];
% [t,x] = ode45(@reaction, trange, initial values)
[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);
% plot drawing
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)
% Defining reaction parameters:
k1 = 6;
k2 = 1;
kminus1 = 2;
% Defining reactions
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!