how to code for system of simultaneous nonlinear differential equation?
이전 댓글 표시
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
Walter Roberson
2022년 4월 29일
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 ?
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'})
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





