Estimate differential equation parameters
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Shashank Prasanna
2013-1-31
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 个评论
Shashank Prasanna
2013-2-1
编辑:Shashank Prasanna
2013-2-1
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.
更多回答(1 个)
Matt J
2013-1-31
编辑:Matt J
2013-1-31
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 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!