equationsToMatrix
我正在尝试使用该函数找到倒置(一件)摆的状态空间模型。我正在使用以下代码:
%Declaration of Variables
syms x(t) t M m ddx(t) l th(t) ddth(t) dth(t) b1 b2 dx(t) F(t) I
%Nonlinear Equations
eqn1=eq((I+m*l^2)*ddth+m*l*cos(th)*ddx-m*g*l*sin(th)+b2*dth,0)
eqn2=eq((M+m)*ddx+m*l*cos(th)*ddth-m*l*sin(th)*(dth)^2+b1*dx,F)
%Linear Equations
eqn1L=subs (eqn1,[cos(th),sin(th(t)),dth(t)^2],[1,th(t),0])
eqn2L=subs (eqn2,[cos(th),sin(th(t)),dth(t)^2],[1,th(t),0])
%Finding State Space Model
[A,B]=equationsToMatrix([eqn2L,eqn1L],[x(t),dx(t),th(t),dth(t)])
C=[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1];
D=[0;0;0;0];
sys = ss(A,B,C,D)
MATLAB 引发以下错误:
sym.getEqnsVars
使用>时出错checkVariables
(第 92 行)
第二个参数必须是符号变量的向量。错误
sym.getEqnsVars
(第 54 行)
checkVariables(vars);
错误
sym/equationsToMatrix
(第 55 行)
[eqns,vars] = sym.getEqnsVars(argv{:});
错误
Linearization_Test
(第 10 行)
[A,B]=equationsToMatrix([eqn2L,eqn1L],[x(t),dx(t),th(t),dth(t)])
如何解决此错误?