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!