Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Correct use of ode45

1 visualizzazione (ultimi 30 giorni)
Marcel Langner
Marcel Langner il 18 Nov 2018
Chiuso: MATLAB Answer Bot il 20 Ago 2021
Hey,
I have got a problem. I dont understand how to use the ode45 solver.
My prerequisites:
Interval: 48 h
Number of Steps: 5
Increment = Interval/Number of steps = 48/5 = 9.6
This range I called SW
SW = (0:48/5:48)
My equation I want to solve is quite simple:
X = x0*exp((muemax-kd)*t)
For a previous task I already implemented a subfunction 'Wachstumsprozess'
Now I want to approximate with ode45.
-----------------------------------------------------------
function abc
% 1a)
x0 = 0.2;
muemax = 0.06;
kd = 0.01;
t = (0:1:48);
x = Wachstumsprozess (x0, muemax, kd, t);
plot (t,x);
% 2a)
SW = (0:48/5:48);
[SW,x2] = Euler(@(SW,x2)Wachstumsprozess(x0, muemax, kd, t), SW, x0);
end
function X = Wachstumsprozess (x0, muemax, kd, t)
X = x0*exp((muemax-kd)*t);
end
function E = Euler (Fkt, SW, Y0)
E = ode45(Fkt, SW, Y0);
end

Risposte (0)

Questa domanda è chiusa.

Community Treasure Hunt

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

Start Hunting!

Translated by