How to solve this system of ODEs

1 回表示 (過去 30 日間)
Sun
Sun 2019 年 8 月 22 日
回答済み: John D'Errico 2019 年 8 月 23 日
Hi,
I have a system in the form of something like this (a * dy/dt) + (b * y) = (c * dx/dt) + (d * x). Data is available for variables x, y & t. How to estimate parameters a, b, c & d?
Is there any in-built tool on MATLAB that can take custom equations like these? Please let me know. Thanks!
Best,
Sun

採用された回答

John D'Errico
John D'Errico 2019 年 8 月 23 日
You have ONE equation, not a system of ODEs.
(a * dy/dt) + (b * y) = (c * dx/dt) + (d * x)
But suppose you knew the true solution for those coefficients, estimated as [a, b, c, d], as the "optimal" set of coefficients. Can you know then that [2*a, 2*b, 2*c, 2*d] is not just as good of a solution? In fact, pick any constant k, and we can see that the set [k*a, k*b, k*c, k*d] is a solution as good as any other. k can even be zero.
That tells you that your problem is not well posed. You can choose ANY of those 4 coefficients, and arbitrarily set it to 1, or to any constant. I'd pick a==1, which is as good as any other. So your problem now reduces to something like this:
dy/dt + b*y = c*dx/dt + d*x
Next, although we don't have your data in hand to show how it might work, you have data of the form of a list of values for t, as well as x and y at each point in time.
So just interpolate x(t) and y(t) as splines. Then use them to infer the values of b, c, and d. Assuming t,x, and y are vectors, it would look like this:
xoft = spline(t,x);
xdot = fnder(xoft)
yoft = spline(t,y);
ydot = fnder(xoft)
A = [-y(:),fnval(xdot,t(:)),x(:)];
bcd = A\fnval(ydot,t(:));
bcd will be a vector of length 3, contining the values of b, c, and d. Remember that a was 1.
fnval and fnder should be part of the curve fitting toolbox as I recall.

その他の回答 (1 件)

darova
darova 2019 年 8 月 22 日
Look like system of equations
It has many solutions. For example d=1:

カテゴリ

Help Center および File ExchangeSpline Postprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by