2nd order differential equations

조회 수: 21 (최근 30일)
Patrick Nowohradsky
Patrick Nowohradsky 2022년 6월 10일
댓글: Ganesh Gudipati 2022년 6월 15일
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
Patrick Nowohradsky
Patrick Nowohradsky 2022년 6월 10일
편집: Patrick Nowohradsky 2022년 6월 10일
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 2022년 6월 15일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by