Script to solve ODEs with two variables: cB and t. (solution included, just cannot write script)

1 次查看(过去 30 天)
Hi,
I have a problem: dcB/dt = k1*(1.5/(1 + 1.5*0.05*t))^2 - 0.022*cB
for t0 = 0 to tf = 30
I have been told ode15s, ode15i, but I cannot figure out how to write the script.
The answer for should be cB = 0.66
Thank you.
(I have symbolic math toolbox to make process simpler)

回答(1 个)

Roshni Garnayak
Roshni Garnayak 2019-9-9
The following code can be used to solve the ODE:
t0 = 0;
tf = 30;
tspan = [t0 tf]; % Specifies the range of variable t
cB0 = 1; % Specify the initial value of cB
[t,cB] = ode15s(@(t,cB) (1.5/(1+1.5*0.05*t))^2-0.022*cB, tspan, cB0);
You can refer to the following link to get a detailed explanation of “ode15s” solver:

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by