Trying to solve linear system of equations into matrix form error

1 vue (au cours des 30 derniers jours)
Jack
Jack le 18 Déc 2020
Commenté : Jack le 18 Déc 2020
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]);

Réponse acceptée

Marco Riani
Marco Riani le 18 Déc 2020
% 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 commentaires
Marco Riani
Marco Riani le 18 Déc 2020
2020b on windows
Jack
Jack le 18 Déc 2020
thanks for all the help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by