Second Order ODE with Power

4 visualizaciones (últimos 30 días)
Shozeal
Shozeal el 29 de Jun. de 2020
Comentada: Star Strider el 30 de Jun. de 2020
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.

Respuesta aceptada

Star Strider
Star Strider el 29 de Jun. de 2020
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 comentarios
Shozeal
Shozeal el 30 de Jun. de 2020
Thank you, Strider.
This line here [VF,Subs] = odeToVectorField(v); is what I've been looking for.
Star Strider
Star Strider el 30 de Jun. de 2020
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by