๐‘Ž๐ด + ๐‘๐ต โ†’ ๐‘P
๐‘‘๐ด/๐‘‘๐‘ก = โˆ’๐พ โˆ— ๐ด โˆ— ๐ต ๐‘‘๐ต/๐‘‘๐‘ก = (๐‘/๐‘Ž) โˆ— (๐‘‘๐ด/๐‘‘๐‘ก) = โˆ’๐‘Œ๐ต โˆ— (๐พ โˆ— ๐ด โˆ— ๐ต) ๐‘‘๐‘ƒ/๐‘‘๐‘ก = โˆ’(๐‘/๐‘Ž) โˆ— (๐‘‘๐ด/๐‘‘๐‘ก) = ๐‘Œ๐‘ƒ โˆ— (๐พ โˆ— ๐ด โˆ— ๐ต)

๋‹ต๋ณ€ (1๊ฐœ)

Davide Masiello
Davide Masiello 2022๋…„ 3์›” 7์ผ
ํŽธ์ง‘: Davide Masiello 2022๋…„ 3์›” 7์ผ

0 ๊ฐœ ์ถ”์ฒœ

This should work:
clear,clc
tspan = [0,10];
y0 = [1,1,0];
[t,y] = ode89(@yourODEsystem,tspan,y0);
plot(t,y)
legend('A','B','P','Location','best')
function out = yourODEsystem(t,y)
% Coefficients
K = 1;
a = 2;
b = 1;
p = 0.5;
% Variables
A = y(1);
B = y(2);
P = y(3);
% Time derivatives
dAdt = -K*A*B;
dBdt = -(b/a)*K*A*B;
dPdt = (p/a)*K*A*B;
% Output
out = [dAdt;dBdt;dPdt];
end
Just replace you actual values of stoichiometric coefficients and kinetic constants.

๋Œ“๊ธ€ ์ˆ˜: 6

Torsten
Torsten 2022๋…„ 3์›” 7์ผ
Have in mind that chemical kinetics ODEs are usually stiff.
Use ode15s instead of ode89.
Navaneetha Krishnan Murugadoss
Navaneetha Krishnan Murugadoss 2022๋…„ 3์›” 7์ผ
Error in TASK>odefcn (line 16)
A = y(1);
Error in TASK (line 6)
[t,y] = ode89(odefcn,tspan,y0);
Davide Masiello
Davide Masiello 2022๋…„ 3์›” 7์ผ
ํŽธ์ง‘: Davide Masiello 2022๋…„ 3์›” 7์ผ
Please show all your code. Moreover, please indicate what version of Matlab you are using.
Navaneetha Krishnan Murugadoss
Navaneetha Krishnan Murugadoss 2022๋…„ 3์›” 7์ผ
clear,clc
tspan = [0,12];
y0=[0 1 3];
[t,y] = ode89(DEdef,tspan,y0);
plot(t,y)
legend('CL','NOM','DBP','Location','best')
function [Ddv_div] = odefcn(t,y)
% Coefficients
K = 5E-5;
YB=1;
YP=0.15;
% Variables
A = y(1);
B = y(2);
P = y(3);
% Time derivatives
dAdt = -K*A*B;
dBdt = -YB*(K*A*B);
dPdt = YP*(K*A*B);
Ddv_div = [-K*A*B;-YB*(K*A*B);YP*(K*A*B)];
% Output
out = [dAdt;dBdt;dPdt];
end
2021b version
Navaneetha Krishnan Murugadoss
Navaneetha Krishnan Murugadoss 2022๋…„ 3์›” 7์ผ
I need to plot concentrations A,B, and P against time. I have to show how the concentrations change over time until ether A is completely depleted
Davide Masiello
Davide Masiello 2022๋…„ 3์›” 7์ผ
The function call in ode89 must be equal to the function name. Write this
clear,clc
tspan = [0,12];
y0=[0 1 3];
[t,y] = ode89(@DEdef,tspan,y0);
plot(t,y)
legend('CL','NOM','DBP','Location','best')
function Ddv_div = DEdef(t,y)
% Coefficients
K = 5E-5;
YB=1;
YP=0.15;
% Variables
A = y(1);
B = y(2);
P = y(3);
% Output
Ddv_div = [-K*A*B;-YB*(K*A*B);YP*(K*A*B)];
end
However, let me point out that if the initial concentration of one of the two reactants is zero (like in your case) you won't observe any change in the concentration of any of the compounds, since the reaction cannot occur.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์นดํ…Œ๊ณ ๋ฆฌ

๋„์›€๋ง ์„ผํ„ฐ ๋ฐ File Exchange์—์„œ Chemistry์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

์ œํ’ˆ

๋ฆด๋ฆฌ์Šค

R2021b

ํƒœ๊ทธ

์งˆ๋ฌธ:

2022๋…„ 3์›” 7์ผ

๋Œ“๊ธ€:

2022๋…„ 3์›” 7์ผ

Community Treasure Hunt

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

Start Hunting!

Translated by