2nd order differential equations

20 Ansichten (letzte 30 Tage)
Patrick Nowohradsky
Patrick Nowohradsky am 10 Jun. 2022
Kommentiert: Ganesh Gudipati am 15 Jun. 2022
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 Kommentare
Patrick Nowohradsky
Patrick Nowohradsky am 10 Jun. 2022
Bearbeitet: Patrick Nowohradsky am 10 Jun. 2022
Like this?
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=matlabFunction(F_s);
phi0 = 0.9424;
phid0 = 0;
tspan=[0 30];
[t,y]=ode15i(F_ss,tspan,phi0,phid0)
figure
t_t=linspace(0,2*pi);
plot(t, y)
Then I get: Warning: Function 'phi' not verified to be a valid MATLAB function
Ganesh Gudipati
Ganesh Gudipati am 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by