Is this equation numerically solvable?

r'' - r θ'^2 = g sinθ - (g-y'')
r'+θ'+y'=0
rθ''+2r'θ'+g cosθ = 0
Sorry may I know how I can solve this with ode45. I am attempting to convert all three equations into 1st Order Coupled equations, but I can't seem to get the second equation into the correct substitution. Is it possible? Or do I have to use another ODE solver (which?)

2 个评论

Hi tch,
The second equation is unlikely, on dimensional grounds to begin with, since theta' has units of 1/sec and the other two terms have units of meters/sec.
Sorry, the original differential equation had theta' multiplied with radius. I just removed the constants to simplify the differential equation. With units aside, is it possible to rewrite these into a system of 1st Order ODEs? Thanks for your help.

请先登录,再进行评论。

回答(1 个)

Stephan
Stephan 2018-10-13
编辑:Stephan 2018-10-13
Hi,
the following code will transform the equations into a form that can be solved with ode45. It creates a file ode_system, that contains the first order system.
Please check the equations for errors i possibly made:
syms r(t) theta(t) y(t) g
eqn1 = diff(r,t,2) - (r*(diff(theta,t)))^2 == g*sin(theta) - (g-diff(y,t,2));
eqn2 = diff(r,t) + diff(theta,t) + diff(y,t) == 0;
eqn3 = r*diff(theta,t,2) + 2*diff(r,t)*diff(theta,t) + g*cos(theta) == 0;
eqn1 = subs(eqn1,g,9.81);
eqn3 = subs(eqn3,g,9.81);
eqn = [eqn1, eqn2, eqn3];
[eqn, vars] = reduceDifferentialOrder(eqn,[r(t) theta(t) y(t)]);
[eqn, vars] = reduceRedundancies(eqn,vars);
[eqn, vars] = reduceDAEToODE(eqn,vars);
[eqn, vars] = odeToVectorField(eqn);
disp(vars)
matlabFunction(eqn,'File','ode_system','Vars',{'t','Y'})
The order of the variables is displayed when running the script. If you have 6 initial conditions for y,r and theta and their derivatives it should be possible to solve the system.
Best regards
Stephan

类别

Community Treasure Hunt

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

Start Hunting!

Translated by