how to code for system of simultaneous nonlinear differential equation?
Show older comments
xt^2 dy/dt +yt^2 dx/dt +2xyt=0;
x dx/dt +y^k dy/dt +GM/t^2 =0;
all the derivatives are partial, since x=x(t,r),y=y(t,r);
r is not used here but x and y are dependent on it.
k lies between 1 and 5/3;
G is gravitational const.
M is mass of any massive object,say sun.
2 Comments
Walter Roberson
on 29 Apr 2022
x=x(t,r)
r is not used here but x and y are dependent on it.
It is not clear to me whether you are working with a Partial Differential Equation system or not? Would there be plans to vary r in the future, or will you intentially only be computing along lines of constant r at any given time ?
Walter Roberson
on 29 Apr 2022
Edited: Walter Roberson
on 29 Apr 2022
I do not seem to have usable initial conditions.
You cannot start at time t = 0 because there is a division by time implied
syms GM k positive
assume(k>=1 & k<=5/3)
syms x(t) y(t)
dx = diff(x); dy = diff(y);
eqn1 = x * t^2 * dy + y * t^2 * dx + 2 * x * y * t == 0;
eqn2 = x * dx + y^k * dy + GM/t^2 == 0;
eqns = [eqn1, eqn2]
these_eqns = subs(eqns, {GM, k}, {1e20, 5/4})
[eqs,vars] = reduceDifferentialOrder(these_eqns,[x(t), y(t)])
initConditions = [1e5 2e7];
[M, F] = massMatrixForm(eqs, vars)
f = M\F
odefun = odeFunction(f,vars)
[t, out] = ode15s(odefun, [1 100], initConditions);
plot(t, out)
legend({'x', 'y'})
Answers (0)
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




