Is this equation numerically solvable?
Mostrar comentarios más antiguos
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 comentarios
David Goodmanson
el 7 de Sept. de 2018
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.
tan chien hao
el 7 de Sept. de 2018
Respuestas (1)
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
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!