Coupled Differential Equations - derivatives on both sides of equations
6 views (last 30 days)
I am trying to solve two coupled differential equations, but I cannot seem to figure out how to get into a form that can be solved with an ode solver. Specifically, I can't get all the derivatives to the left hand side of the equations.
The equations are:
Any help would be greatly appreciated.
Andrew Newell on 27 Aug 2017
Edited: Andrew Newell on 27 Aug 2017
Let's simplify things a little bit so we can better see what is going on. Let
Y = [x; y];
G1(t,Y) = 0.000053+g1(Y(1),t);
G2(t,Y) = 0.000053+g2(Y(2),t);
Then a little rearrangement gives
G1(t,Y)*(d/dt)Y(1) - 0.0000265*(d/dt)Y(2) = F1(t,Y)
G2(t,Y)*(d/dt)Y(2) - 0.0000265*(d/dt)Y(1) = F2(t,Y)
where F1(t,Y) and F2(t,Y) bundle all the remaining terms together. If we now define a "mass matrix"
M(t,Y) = [G1(t,Y) -0.0000265; -0.0000265 G2(2,Y)]
(see the odeset documentation) and a function
F(t,Y) = [F1(Y,t); F2(Y,t)];
then we can define
options = odeset('Mass',M);
and solve something like
[t,y] = ode45(F,tspan,y0)
(see the ode45 documentation). You'll have to define functions F(t,Y) and M(t,Y) to reproduce the above steps. Warning: I have been using a mixture of MATLAB and regular math to keep it simple; you can sort out the details.