Trying to solve linear system of equations into matrix form error

5 visualizzazioni (ultimi 30 giorni)
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]);

Risposta accettata

Marco Riani
Marco Riani il 18 Dic 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 Commenti

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Systems Of Linear Equations in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by