2nd order differential equations
Show older comments
For a Project I got to solve these Lagrange equations!
sdolve does not work
I tried formulating 2 equations of first order instead of one equation of second order, but this does not work either. Because there is no explicit solution. Start values would be: phi(0)==0.9424, phi_dot(0)==0
any ideas?
clear
Parameter
m= 100;
c= 3588;
g= 9.81;
syms phi(t) m c g
alpha=sin((1.7-2.1*cos(phi(t)))/3.6);
r1=((-2.1*sin(phi(t))+1.8*cos(alpha))^2+(2.1*cos(phi(t))+1.8*sin(alpha))^2)^0.5;
r1_d=diff(r1);
alpha_d=diff(alpha);
Energie
U=1/2*c*(1.8^2+0.6^2-2*1.8*0.6*cos(phi(t)));
W=m*g*(2.1*cos(phi(t))+1.8*sin(alpha));
V=U+W
T_trans=0.5*m*r1_d^2;
T_rot=1/3*m*3.6^2*alpha_d^2;
T=T_trans+T_rot
Lagrange
T_dv=diff(T,diff(phi(t)));
L_1=diff(T_dv,t);
L_2=diff(T,phi(t));
L_3=diff(V,phi(t));
F=L_1-L_2+L_3
F_s=simplify(F)
F_ss=solve(F_s,diff(phi(t), t, 2))
3 Comments
Torsten
on 10 Jun 2022
any ideas?
Use "matlabFunction" to create a function handle for your differential equation(s)
matlabFunction(F)
and use "ode15i" to solve the equations numerically.
Patrick Nowohradsky
on 10 Jun 2022
Edited: Patrick Nowohradsky
on 10 Jun 2022
Ganesh Gudipati
on 15 Jun 2022
Since you didn't initialize the variable phi, MATLAB would be searching if there exists a function 'phi'.
Firstly, intialize the value of phi and procced. This should resolve your error.
Answers (0)
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!