Second Order ODE with Power

3 次查看(过去 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