unknown parameters differential equation

3 vues (au cours des 30 derniers jours)
Tilai
Tilai le 9 Déc 2014
Commenté : Tilai le 18 Déc 2014
Dear all, I have been struggling with a fairly simple problem but I was hoping for your suggestions. I am trying to solve a set of 2 d.e. with 4 unknown coefficients. I have experimental data and their corresponding time that I would like to fit it to.
A simple case: u'=c1* v - c2 v'=c3* u
[u; v]= [0; 1] at t=0 [u; v]= [-20.0404; -11.5703] at t=1/3*pi
How do I get the values for c1, c2, c3 now? (I am using dsolve to find the solution, but not sure how to compare this with the values at t=1/3*pi)
Thank you for your ideas

Réponse acceptée

Amit
Amit le 9 Déc 2014
The issue here is that you have 3 parameters and 2 equations, so there might not exist an unique solution. However if there exist an unique solution, you can do something like this - Create two function separately (an example below)
function 1: Differential equation
function dy = RKx(t,y,c)
dy = zeros(2,1);
% u'=c1* v - c2 v'=c3* u
% y = [u;v]
dy(1) = c(1)*y(2) - c(2);
dy(2) = c(3)*y(1);
Function 2: This will be optimized
function yval = optimX(C)
yAtTf = [-20.0404 -11.5703];
tspan = [0 pi()/6 pi()/3];
y0 = [0;0];
[~,Y] = ode45(@(t,y) RKx(t,y,C),tspan,y0);
yval = norm(Y(3,:) - yAtTf,2);
In ths end, you minimize the objective optimX using functions like fminunc or fmincon etc (an example below) -
[y,fval] = fminunc(@optimX,rand(3,1))
Hope this will get you to a point where you can figure it out.
  2 commentaires
Tilai
Tilai le 10 Déc 2014
Dear Amit,
Thanks a lot for your quick and nicely explained answer. Today I managed to try and understand your explanation and then try it out on matlab. It is working perfectly. Now I will expand it to my case with 4 coefficients and more experimental data. But I am confident it should work now! Will post an update when I finish that part. Thanks for taking the time to help me!
Cheers!
Tilai
Tilai le 18 Déc 2014
Thank you again, the solution worked out great when I adapted it for my original problem!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by