- Monod kinetics and curve fitting (link)
- Solving Coupled Differential Equations (link)
- Parameter Estimation for a System of Differential Equations (link)
Solve a system of equations
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jacob Barrett-Newton
le 2 Mar 2018
Commenté : Star Strider
le 23 Mar 2018
So I have written a system of equations and used ode45 to solve it. I was just wondering if there is a more efficient way to do it. I am creating an ODE model and will later use certain methods to find the unknown parameters, but for now I am just guessing random values.
I have written my model as
function dydt = ODE_Model(t,y,p_1,p_2,p_3,d_1,d_2,d_3,a,b,Tau)
dydt = zeros(3,1);
dydt(1) = p_1*(a*cos(t*2*pi/365-Tau)+b)-d_1*y(1);
dydt(2) = p_2*(a*cos(t*2*pi/365-Tau)+b)-d_2*y(2);
dydt(3) = p_3*y(1)-d_3*y(2)*y(3);
end
and then solved it using
tspan = [0 5];
y0 = [4 5 6];
p_1 = 1;
p_2 = 1;
p_3 = 1;
d_1 = 1;
d_2 = 1;
d_3 = 1;
a=1;
b=1;
Tau=1;
SolExp = ode45(@(t,y) ODE_Model(t,y,p_1,p_2,p_3,d_1,d_2,d_3,a,b,Tau), tspan, y0);
TimePoints = 0:0.1:2;
y = deval(SolExp, TimePoints);
clf
plot(TimePoints, y)
I wanted to do P and D as a combined vector, so i would have P(1) .. P(6) and then i could just write something like P = [1 1 1 1 1 1], but reading about ode45 it seems I can only use one variable? I am not sure. Is there a neater way to do what I want to do, or is this as neat it gets?
Thanks
0 commentaires
Réponse acceptée
Star Strider
le 2 Mar 2018
These may provide you with an approach appropriate to your problem:
All of these involve estimating the parameters of a system of differential equations, using lsqcurvefit to do the regressions.
10 commentaires
Star Strider
le 4 Mar 2018
It seems to be similar. The point is that if you believe that guessing the parameters could eventually fit your data, then a more sophisticated and less stochastic approach will likely work.
I would have to have a representative sample and description of your data, what results of your system of differential equations you are fitting to it (for example, the Igor Moura code fits all the results of the integration to the data, while the Monod Kinetics code fits one result), and a description of what you want to do.
The optimization technique you choose to estimate your parameters can be anything. I have use everything from fminsearch to ga (genetic algorithm), depending on the context.
So it is probably possible to estimate your parameters. I can’t say for certain until I see your data, and know what you want to do.
Plus de réponses (1)
Jacob Barrett-Newton
le 5 Mar 2018
16 commentaires
Star Strider
le 23 Mar 2018
When I ran your code with ‘y0(2)~=0’, the warning is:
Warning: Failure at t=2.354295e+02. Unable to meet integration tolerances without
reducing the step size below the smallest value allowed (4.547474e-13) at time t.
So it’s encountering a singularity there, and fails to complete the ‘dY’ vector. That’s the reason it throws the
Matrix dimensions must agree.
error in lsqcurvefit. I don’t see any obvious reason for that to occur. I defer to you to troubleshoot it, and be certain your kinetics equations in ‘DifEq’ are correct.
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!