Solving coupled differential equations

42 views (last 30 days)
Jon
Jon on 21 Apr 2023
Commented: David Goodmanson on 23 Apr 2023
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 Comment
David Goodmanson
David Goodmanson on 23 Apr 2023
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.

Sign in to comment.

Answers (2)

Torsten
Torsten on 21 Apr 2023
  1 Comment
Jon
Jon on 21 Apr 2023
Edited: Jon on 21 Apr 2023
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..

Sign in to comment.


Sam Chak
Sam Chak on 22 Apr 2023
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 Comments
Sam Chak
Sam Chak on 22 Apr 2023
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 on 22 Apr 2023
Edited: Sam Chak on 22 Apr 2023
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

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!