フィルターのクリア

Why am I receiving an error for "odeToVectorField" when I am trying to convert second order differential equations to 1st order differential equations?

3 ビュー (過去 30 日間)
I have these three differential equations that I need to convert to first order, except the code errored and I recieved the following:
"Unable to convert the initial value problem to an equivalent dynamical system. Either the differential equations cannot be solved for the highest derivatives or inappropriate
Error in mupadengine/evalin_internal
Error in mupadengine/fevalHelper
Error in mupadengine/feval_internal
Error in odeToVectorField>mupadOdeToVectorField (line 171)
T = feval_internal(symengine,'symobj::odeToVectorField',sys,x,stringInput);
Error in odeToVectorField (line 119)
sol = mupadOdeToVectorField(varargin);
Error in DoubleIP_math (line 20)
V = odeToVectorField(eqn1_5,eqn1_4,eqn1_3)"
eqn1_5 = (m0 + m1 + m2)*diff(x,2) + (m1*l1 + m2*L2)*cos(theta1)*diff(theta1,2) + m2*l2*cos(theta2)*diff(theta2,2) - (m1*l1 + m2*L1)*sin(theta1)*(diff(theta1,1))^2 - m2*l2*sin(theta2)*(diff(theta2,1))^2 == u(t);
Unrecognized function or variable 'm0'.
% eqn1_5_f = odeToVectorField(eqn1_5)
eqn1_4 = (m1*(l1)^2 + m2*(L1)^2 + I1)*diff(theta1,2) + (m1*l1 + m2*L1)*cos(theta1)*diff(x,2) + m2*L1*l2*cos(theta1-theta2)*diff(theta2,2) + m2*L1*l2*sin(theta1-theta2)*(diff(theta2,1))^2 - g*(m1*l1 + m2*L1)*sin(theta1) == 0;
% eqn1_4_f = odeToVectorField(eqn1_4)
eqn1_3 = m2*l2*cos(theta2)*diff(x,2) + m2*L1*l2*cos(theta1-theta2)*diff(theta1,2) + (m2*(l2)^2 + I2)*diff(theta2,2) - m2*L1*l2*sin(theta1-theta2)*(diff(theta1,1))^2 - m2*g*l2*sin(theta2) == 0;
% eqn1_3_f = odeToVectorField(eqn1_3)
V = odeToVectorField(eqn1_5 ,eqn1_4, eqn1_3)
  1 件のコメント
Akekaphop Kesavadhana
Akekaphop Kesavadhana 2024 年 3 月 6 日
I already have defined the variables to be symbolic and the issue persisted. Any other ideas?
% syms m0 m1 m2 l1 l2 L1 L2 I1 I2 g u(t) x(t) theta1 theta2

サインインしてコメントする。

採用された回答

Sam Chak
Sam Chak 2024 年 3 月 6 日
Previously, theta1 and theta2 were created as scalar variables when they should be functions of time.
% syms m0 m1 m2 l1 l2 L1 L2 I1 I2 g u(t) x(t) theta1 theta2
% ^^^^ ^^^^
syms m0 m1 m2 l1 l2 L1 L2 I1 I2 g u(t) x(t) theta1(t) theta2(t)
eqn1_5 = (m0 + m1 + m2)*diff(x,2) + (m1*l1 + m2*L2)*cos(theta1)*diff(theta1,2) + m2*l2*cos(theta2)*diff(theta2,2) - (m1*l1 + m2*L1)*sin(theta1)*(diff(theta1,1))^2 - m2*l2*sin(theta2)*(diff(theta2,1))^2 == u(t);
eqn1_4 = (m1*(l1)^2 + m2*(L1)^2 + I1)*diff(theta1,2) + (m1*l1 + m2*L1)*cos(theta1)*diff(x,2) + m2*L1*l2*cos(theta1-theta2)*diff(theta2,2) + m2*L1*l2*sin(theta1-theta2)*(diff(theta2,1))^2 - g*(m1*l1 + m2*L1)*sin(theta1) == 0;
eqn1_3 = m2*l2*cos(theta2)*diff(x,2) + m2*L1*l2*cos(theta1-theta2)*diff(theta1,2) + (m2*(l2)^2 + I2)*diff(theta2,2) - m2*L1*l2*sin(theta1-theta2)*(diff(theta1,1))^2 - m2*g*l2*sin(theta2) == 0;
[V, S] = odeToVectorField(eqn1_5 ,eqn1_4, eqn1_3)
V = 
S = 

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by