Is this equation numerically solvable?
Mostra commenti meno recenti
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 Commenti
David Goodmanson
il 7 Set 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
il 7 Set 2018
Risposte (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
Categorie
Scopri di più su Ordinary Differential Equations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!