# How do I represent equations of motion of a dynamic system in State Space?

I'm going through some vibration theory and I need to represent the equations in state space for vibration control.

The main forced general equation of motion is:

$$\mathbf{M{\ddot q}+{\Omega_c}G{\dot q}+{[K_b+K_m-\Omega_c^2K_\Omega]q}=T(t)+F(t)}$$

• $K_b$: bearing stiffness symmetrical matrix
• $K_m$: mess stiffness matrix
• $K_\Omega$: diagonal centripetal stiffness matrix
• $T$: applied external torque
• $F$: static transmission error excitation
• $q$: the vector with the traslation and rotational coordinates for the sun,ring and carrier

If I'm not mistaken, for this equation the input variables would be the forces $F(t)$ and $T(t)$ plus the $q$ terms, which would form the $B$ matrix and $u$ input vector in state space form.

But for the free vibrations I have the equation:

$$\mathbf{M{\ddot q}+{[K_b+K_m]q}=0}$$

Would the input variables in this case just be equal to zero? and the output variables just $\mathbf{{\ddot q}}$ ? I'm also trying to code this into Matlab and Maple, which can directly get me the state space form of really long equations by just inputting the equation, input variables and output variables.

• It is a second order equation, so you can take $[q, \dot{q}]^\intercal$ as state. – Karlo Jun 30 '17 at 18:06
• In general the only solution of your "free vibration" equation is $\mathbf{q} = \mathbf{\dot q} = \mathbf{\ddot q} = \mathbf{0}$, except when $\mathbf{q}$ is an eigenvector. Also, I don't understand why you dropped the terms containing $\mathbf{\Omega_c}$ from your free vibration equation - the natural vibration frequencies and mode shapes depend on $\mathbf{\Omega_c}$! – alephzero Jun 30 '17 at 18:38
• @Karlo Sorry, Mechanical Engineering is not really my field, what do you mean q, qdot as a state? – spe4ker Jun 30 '17 at 21:59
• @alephzero thank you, I ignored it this time for simplicity, my actual equations are :$\mathbf{ m_s (-\Omega({\dot y_s})+{\ddot x_s} )-m_s(\Omega x_s+\dot y_s)\Omega+k_sx_s }$, $\mathbf{ m_s (-\Omega({\dot x_s})+{\ddot y_s} )+m_s(-\Omega y_s+\dot x_s)\Omega+k_sy_s }$, $\mathbf{ I/r^2 ({\ddot u_s}) }$ where $\ddot u_s$ is a rotational coordinate. In this case which would be my input and output variables? – spe4ker Jun 30 '17 at 22:19
• @quo It is a control engineering term: in state space, when using the representation $\dot{x}=Ax+Bu,\ y=Cx+Du$ ($x$ state, $u$ input, $y$ output), an important question is the choice of the state $x$. See also Orion Yeung's answer. – Karlo Jul 1 '17 at 13:58

Karlo mentioned to use the state space of $[q,\dot{q}]^T$ this allows you to write the system as a first order differential equation of state space. If $X$ were the state space, you could write $\dot{X} = f(X)$. As far as the work you need to do, you write that

$$X = \begin{bmatrix} q\\ \dot{q}\end{bmatrix}$$

the derivative of $\frac{dq}{dt}=\dot{q}$ which is part of X and $\frac{d\dot{q}}{dt}=\ddot{q}$ which can be solved for algebraically in the ODE.

$$\frac{dX}{dt} = \begin{bmatrix} \dot{q}\\ KM^{-1}q \end{bmatrix}$$

for the undamped system. If you intend on using a numerical solver in matlab (maybe ode45) it would look something like this assuming all your system parameters are defined as matrices with similar names and IC is the initial condition and tmin and tmax are time bounds you're interested in for a solution.

dxdt = @(x) [x(2); M\K*x(1)];
[q,t] = ode45(dxdt, [tmin, tmax], IC);


ode45 specifically expects this form: where the first parameter is a vector that is the derivative of a coordinate/state space vector. Notice we would have the same code if we instead used something that wasn't second order by notation, but the condition that $\dot{s}=t$ makes it second order.

$$\frac{dX}{dt} = \frac{d}{dt}\begin{bmatrix} s \\ t \end{bmatrix} = \begin{bmatrix} t \\ KM^{-1}s \end{bmatrix}$$

Using this technique, we can write any system that is a Nth order differential equation as a first order equation of an Nth order state space.

Edit: After seeing your most recent comment, your state space could be written as: $$X = \begin{bmatrix} x\\y\\u \\ \dot{x}\\\dot{y}\\\dot{u}\end{bmatrix}$$

I think I misunderstood what you meant by using matlab and maple. Your inputs are known\controlled values, so $F(t)$ and $T(t)$ along with the system parameters, like $K$, outputs are system behavior, like $x,y,u$ and their derivatives, what you don't know upon the formulation of the equation, but you don't need maple to construct the equation for you, it's just the ones you find from the algebra.

Lastly, I somehow didn't notice your controller forces $T(t)$ and $F(t)$ and didn't write them into the first parameter of the solver, but those can be written in as well, as they are. It would just be that $\ddot{q}=M^{-1}(Kq-T(t)-F(t))$.

• that's a very good explanation, thank you. I've read that there are many ways of representing ODEs in state space, what does the ss form depend on? – spe4ker Jul 1 '17 at 21:12