Second Order ODE with Power

조회 수: 3 (최근 30일)
Shozeal
Shozeal 2020년 6월 29일
댓글: Star Strider 2020년 6월 30일
Hello,
I have this form of equation
x'' = A/x^2 *(B+C*(x')^2+C*(x')^4)
I wrote this script
syms x(t) A B C D vb b
v=diff(x,t,2)==(A/x)*(B+C*(diff(x,t))^2+(C*(diff(x,t))^4);
Dx=diff(x,t);
initial = [x(0)==b, Dx(0)==vb];
xSol(t) = dsolve(v,initial)
But I had this output
Warning: Unable to find explicit solution.
xSol(t) =
[ empty sym ]
I thought of solving it to some extent and apply numerical methods. I later came up with an equation of the form
integral ((A+B*X^a)/(C+D*X^a))dx, please note that constants A, B, C, and D here are different from the ones above.
This, I believe is a form of hypergeometric expression. I don't know how to move further from here.
Thank you.

채택된 답변

Star Strider
Star Strider 2020년 6월 29일
The best way to integrate it numerically is something like this:
syms x(t) A B C D vb b Y t
v=diff(x,t,2)==(A/x)*(B+C*(diff(x,t))^2+(C*(diff(x,t))^4));
[VF,Subs] = odeToVectorField(v);
odefcn = matlabFunction(VF, 'Vars',{t,Y,A,B,C,D})
A = ...;
B = ...;
C = ...;
D = ...;
tspan = ...;
b = ...;
vb = ...;
ic = [b; vb];
[T,X] = ode45(@(t,Y)odefcn(t,Y,A,B,C,D), tspan, ic);
figure
plot(T,X)
legend(string(Subs))
I chose ode45 here because it usually works. If the constants vary by several orders-of-magnitude, the equation would likely be ‘stiff’ and a different solver, such as ode15s would be necessary.
  댓글 수: 2
Shozeal
Shozeal 2020년 6월 30일
Thank you, Strider.
This line here [VF,Subs] = odeToVectorField(v); is what I've been looking for.
Star Strider
Star Strider 2020년 6월 30일
As always, my pleasure!
I am happy to have helped you find it! It and matlabFucntion will allow you to create the function the numeric differential funciton integrators need.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by