Trying to solve linear system of equations into matrix form error

1 次查看(过去 30 天)
Here is my line of code and looking to put into matrix form Ax=B.
I keep getting the error "Unable to convert to matrix form because the system does not seem to be linear"
Any ideas on how to fix this? I am new to matlab and do not know if it is just syntax.
syms m1 ac1 g rot1x R2 f2 f1 m2 ac2 rot2x R3 f3 f2 a1 l1 w_dot1 l1 w1 a2 l2 w_dot2 w2 a0 l0 w_dot0 w0
eqn1 = (m1 * ac1) - (m1 * g * rot1x) - (R2*f2) == f1;
eqn2 = (m2 * ac2) - (m2 * g * rot2x) + (R3 * f3) == f2;
eqn3 = a1 + (0.5 * l1 * w_dot1) + (0.5 * l1 * w1) == ac1;
eqn4 = a2 + (0.5 * l2 * w_dot2 + 0.5 * l2 * w2) == ac2;
eqn5 = R2 * (a0 + l0 * w_dot0) + (l0 * w0) - a1 == 0;
eqn6 = R3 * (a1 + l1 * w_dot1) + (l1 * w1) - a2 ==0;
[A,B] = equationsToMatrix([eqn1, eqn2, eqn3, eqn4, eqn5, eqn6]);

采纳的回答

Marco Riani
Marco Riani 2020-12-18
% eqns must be linear in vars.
% Specify vars as follows (for example).
vars=[m1, m2, w1, w2, w_dot0, w_dot1];
[A,B] = equationsToMatrix([eqn1, eqn2, eqn3, eqn4, eqn5, eqn6],vars);
% Of course I do not what are your vars so I tried to guess
  5 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by