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

1 view (last 30 days)
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)

Answers (1)

Roshni Garnayak
Roshni Garnayak on 9 Sep 2019
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:

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!