Finding min and max of ODEs

7 ビュー (過去 30 日間)
Sara
Sara 2020 年 7 月 4 日
コメント済み: Sara 2020 年 7 月 4 日
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")

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 7 月 4 日
編集済み: Ameer Hamza 2020 年 7 月 4 日
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
  1 件のコメント
Sara
Sara 2020 年 7 月 4 日
Thank you!! :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by