Rearranging dynamic equations

I’m deriving dynamic equations for a simple system, this is what I get:

How can I rearrange these 2 equations into the form like this:

My code is:

Subscript[x, 1] = -Subscript[q, 1][t] R;
Subscript[y, 1] = 0;
Subscript[x, 2] =
Subscript[x, 1] + Subscript[l, c] Cos[Subscript[q, 2][t]];
Subscript[y, 2] = Subscript[l, c] Sin[Subscript[q, 2][t]];
Subscript[v, 1] = Sqrt[
D[Subscript[x, 1], t]^2 + D[Subscript[y, 1], t]^2];
Subscript[v, 2] = Sqrt[
D[Subscript[x, 2], t]^2 + D[Subscript[y, 2], t]^2];
Subscript[w, 1] = D[Subscript[q, 1][t], t];
Subscript[w, 2] = D[Subscript[q, 2][t], t];
K = 1/2 (Subscript[II, 1] Subscript[w, 1]^2) +
1/2 (Subscript[II, 2] Subscript[w, 2]^2) +
1/2 (Subscript[m, 1] Subscript[v, 1]^2) +
1/2 (Subscript[m, 2] Subscript[v, 2]^2);
P = g*Subscript[l, c]*Subscript[m, 2]*Sin[Subscript[q, 2][t]];
L = K – P;
eq1 = Simplify[
D[D[L, Subscript[q, 1]'[t]], t] – D[L, Subscript[q, 1][t]] ==
u[t]];
eq2 = Simplify[
D[D[L, Subscript[q, 2]'[t]], t] – D[L, Subscript[q, 2][t]] == 0];

Thank you!

=================

  

 

please add your code to your question. to make it easy for people to try and help you
– Conor Cosnett
Feb 19 at 20:05

  

 

have you tried typing them into wolfram alpha?
– Conor Cosnett
Feb 19 at 20:15

=================

1 Answer
1

=================

this should get you started:

{{d1, m12}, {m11, zero}} = CoefficientList[ eq1[[2]], {q1”[t], q2”[t]}]

note Simplify decided to put u[t] on the left and the eq1[[2]] is picking the right hand side of the simplified equation. You’d probably be better off to work directly with your left side expression before building it into an equation.