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.

 Réponse acceptée

Star Strider
Star Strider le 29 Juin 2020

0 votes

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 commentaires

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by