Estimate differential equation parameters
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear all,
I need to estimate a parameter of a second order differential equation. This equation is a law of the displacement of a floating body. I know a solution in time domain coming from the experimental investigation but the roblem are the values of the parameters. Is there any function to estimate a differetial equation parameters?
Thanking in advance
Alessandro Antonini
0 commentaires
Réponse acceptée
Shashank Prasanna
le 31 Jan 2013
You can set up an optimization problem to 'fit' your ode to the experimental data for certain parameters that minimize the error between the fitted and real data.
Here is a link in the documentation that explains how to go about this: http://www.mathworks.com/help/optim/ug/optimizing-a-simulation-or-ordinary-differential-equation.html
3 commentaires
Shashank Prasanna
le 1 Fév 2013
Modifié(e) : Shashank Prasanna
le 1 Fév 2013
Ok, at this point i am assuming you know how to set up an ode and solve it using ODE45, if you are not sure then please look through some examples in: http://www.mathworks.com/help/matlab/ref/ode45.html
I am going to assume you ode function is 'odefun' as in some examples in the link, but with an extra parameter p passed by the optimizer.
Create your objective function such that it minimizes the error between your fitted ode result for a given parameter(s) p.
function err = odefit(exp_t,exp_y,p)
[t,y] = ode45(@(t,y)odefun(t,y,p),exp_t,0) % i am using y0=0 you can choose whatever.
err = sum((y-exp_y).^2); % compute error between experimental y and fitted y
end
p_estimate = fminsearch(@(p)odefit(exp_t,exp_y,p),p0);
Choice of optimization function is left to you and some dangers are listed in the link i gave in the previous post.
Plus de réponses (1)
Matt J
le 31 Jan 2013
Modifié(e) : Matt J
le 31 Jan 2013
If it's a linear differential equation with constant unknown coefficients, just evaluate both sides of your differential equation at lots of time points. This will result in a linear system of equalities in the unknown parameters x(i), representable in matrix/vector form as
A*x=b
Then solve by doing x=A\b.
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!