Solving coupled differential equations

조회 수: 64 (최근 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 CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by