Solving coupled differential equations

40 ビュー (過去 30 日間)
Jon
Jon 2023 年 4 月 21 日
コメント済み: David Goodmanson 2023 年 4 月 23 日
I am trying to solve the following coupled differential equation:
.
The goal is to obtain analytic solutions of and in terms of , and .
However, MATLAB doesn't seem to obtain the analytic solutions, as posted below. But I do think that we can get and in terms of , and . Is there any other way I can try to solve the problem in MATLAB (or analytically)?
  1 件のコメント
David Goodmanson
David Goodmanson 2023 年 4 月 23 日
Hi Jon,
In general there won't be an analytical solution, even if Int f(t) dt has an analytic expression. For y, you have the second order differential equation
y'' + y'(-f/f + gamma) + f^2 y = 0
(there is a similar expression for x''). This may or may not (and in most cases does not) have an analytic solution.

サインインしてコメントする。

回答 (2 件)

Torsten
Torsten 2023 年 4 月 21 日
  1 件のコメント
Jon
Jon 2023 年 4 月 21 日
編集済み: Jon 2023 年 4 月 21 日
Thank you Torsten. Unfortunately, the second equation you entered in the link has to be x'(t) = f(t)y(t) (as well as the first equation). But then the WolframAlpha doesn't give the solution (https://www.wolframalpha.com/input?i=y%27%28t%29+%3D+-f%28t%29*x%28t%29-gamma*y%28t%29%2C+x%27%28t%29%3Df%28t%29*y%28t%29), which I believe means that there's no analytic solution..

サインインしてコメントする。


Sam Chak
Sam Chak 2023 年 4 月 22 日
Hi @Jon
I'm unsure if the system has a general analytical solution.
In Pure Math, from the properties of a stable 2nd-order ODE, if , and is monotonically increasing, then the system will converge to the origin. Perhaps, the analytical solution exists for a certain type of .
Here is a simple demonstration using 3 different monotonically increasing functions of :
Definition of state variables:
tspan = linspace(0, 20, 2001);
x0 = [1 0];
[t, x] = ode45(@odefcn, tspan, x0);
% Solution Plot
plot(t, x(:,1), 'linewidth', 1.5, 'color', '#528AFA'),
grid on, xlabel('t'), ylabel('x_{1}')
% Phase Portrait
plot(x(:,1), x(:,2), 'linewidth', 1.5, 'color', '#FA477A'),
grid on, xlabel('x_{1}'), ylabel('x_{2}')
function xdot = odefcn(t, x)
ft1 = tanh(t);
ft2 = t;
ft3 = t^3;
gamma = 1; % gamma > 0
xdot = zeros(2, 1);
xdot(1) = ft3*x(2); % <-- change to ft1, or ft2
xdot(2) = - ft3*x(1) - gamma*x(2); % <-- change to ft1, or ft2
end
  2 件のコメント
Sam Chak
Sam Chak 2023 年 4 月 22 日
Hi @Jon, The trivial solution would be having as a constant function.
syms y(t) x(t) gamma
sym('gamma', 'real');
assume(t > 0)
f(t) = sign(t);
eqns = [diff(y,t) == f(t)*x,
diff(x,t) == - f(t)*y - gamma*x];
sol = dsolve(eqns);
display(sol.y)
ans = 
However, WolframAlpha shows that analytical solutions (click on the ODEs) exist for
and
.
Sam Chak
Sam Chak 2023 年 4 月 22 日
編集済み: Sam Chak 2023 年 4 月 22 日
Hi @Jon, only certain functions of have analytical solutions.
Analytical solution:
can also be expressed as
.
Click on the 2nd-order ODE to see the analytical solution and plots on WolframAlpha.
Note: By the way, this ODE can be rewritten in Sturm–Liouville form. Perhaps, if your problem can be transformed to become a Sturm–Liouville problem, then the analytical solution exists.
syms y(t) gamma
gamma = 2;
Dy = diff(y,t);
eqn = diff(y,t,2) + (gamma - 1)*Dy + exp(2*t)*y == 0;
cond = [y(0)==1, Dy(0)==0];
ySol(t) = dsolve(eqn, cond)
ySol(t) = 
Numerical solution:
tspan = linspace(0, 10, 1001);
x0 = [1 0];
[t, x] = ode45(@odefcn, tspan, x0);
% Solution Plot
plot(t, x(:,1), 'linewidth', 1.5, 'color', '#528AFA'),
grid on, xlabel('t'), ylabel('x_{1}')
% Phase Portrait
plot(x(:,1), exp(t).*x(:,2), 'linewidth', 1.5, 'color', '#FA477A'),
ylim([-2 2]), grid on,
xlabel({'$y_{t}$'}, 'interpreter', 'latex', 'fontsize', 16),
ylabel({'$\dot{y}_{t}$'}, 'interpreter', 'latex', 'fontsize', 16)
function xdot = odefcn(t, x)
ft = exp(t);
gamma = 2; % gamma > 0
xdot = zeros(2, 1);
xdot(1) = ft*x(2); % <-- change to ft1, or ft2
xdot(2) = - ft*x(1) - gamma*x(2); % <-- change to ft1, or ft2
end

サインインしてコメントする。

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by