How can I use Euler's method to solve this ODE problem in MATLAB?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
The well-know Michealis-Menten reaction equation for enzymatic reactions is a 2 parameter kinetic model,
dC/dt = - Vm * C/(Km + C)
where C is the reactant concentration, and Vm and Km are reaction rate constants.
For Vm = 20 mmol/L-min, Km = 10 mmol/L and at t = 0 min, Co=100 mmol/L,
use the Euler and Heun methods to estimate a numerical solutions for 0<t<10, plotting the concentration as a function of time for the Michealis-Menten equation for the following step sizes:
a) step size = 1 min
b) step size = 0.5 min
c) step size = 0.1 min
What do you observe about the accuracy/precision of the models?
2 comentarios
James Tursa
el 9 de Mzo. de 2018
What have you done so far? What specific problems are you having with your code? For starters, this appears to be a 1st order ODE, not a 2nd order ODE.
Respuestas (1)
James Tursa
el 9 de Mzo. de 2018
Looks like you have been given the complete integrator code, and all you need to do is define the derivative function f. Although you don't show it, I am assuming that f is actually an input argument to this integrator routine. Can you confirm this? Assuming this is true, all you need to do is define a function handle in the calling routine that calculates the derivative given the time and the current state ... i.e. your derivative function needs to have the signature dy = f(t,y). So here is what you do with the information you have been given:
Given this ODE:
dC/dt = - Vm * C/(Km + C)
and given these constants:
Vm = 20 mmol/L-min, Km = 10 mmol/L
and given this initial condition:
at t = 0 min, Co=100 mmol/L,
and given this desired time span in minutes:
0<t<10
Define your constants in m-code:
Vm = 20; % mmol/L-min
Km = 10; % mmol/L
Construct your derivative function handle in m-code:
f = @(t,C) = - Vm * C/(Km + C);
Define your initial condition in m-code:
Co = 100; % mmol/L
And define your time span in m-code:
tspan = [0 10]; % min
It also appears that your integrator code needs the number of iterations, Niter. To get that for a desired step size, simply solve this equation that is found in the above code for Niter, so that given a desired hstep you can calculate Niter. The tend and t0 are from the desired time span.
hstep=(tend-t0)/Niter
These are the pieces that you need to solve your problem. Just have these pieces in your caller routine and pass them to your integrator routine as input arguments in the appropriate spots. Give it a try ...
0 comentarios
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!