unknown parameters differential equation

조회 수: 2 (최근 30일)
Tilai
Tilai 2014년 12월 9일
댓글: Tilai 2014년 12월 18일
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

채택된 답변

Amit
Amit 2014년 12월 9일
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
Tilai
Tilai 2014년 12월 10일
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 2014년 12월 18일
Thank you again, the solution worked out great when I adapted it for my original problem!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by