Trying to solve linear system of equations into matrix form error
5 次查看(过去 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]);
0 个评论
采纳的回答
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Systems Of Linear Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!