I am trying to follow this tutorial: http://ctms.engin.umich.edu/CTMS/index.php?example=InvertedPendulum§ion=SystemModeling
I am stuck to understand how to make a state-space representation from these transfer functions
$$ \frac{\Phi(s)}{U(s)} = \frac{\frac{ml}{q}s}{s^3+\frac{b(I+ml^2)}{q}s^2-\frac{(M+m)mgl}{q}s-\frac{bmgl}{q}} \\ \frac{X(s)}{U(s)} = \frac{\frac{(I+ml^2)s^2-gml}{q}}{s^4+\frac{b(I+ml^2)}{q}s^3-\frac{(M+m)mgl}{q}s^2-\frac{bmgl}{q}s} $$
The text gives a hint "The linearized equations of motion from above can also be represented in state-space form if they are rearranged into a series of first order differential equations. Since the equations are linear, they can then be put into the standard matrix form shown below."
But I do not understand this hint, I tried to research on to reduce the order like on http://tutorial.math.lamar.edu/Classes/DE/ReductionofOrder.aspx but maybe you can give me more input to my brain.
Solution: $$ \begin{bmatrix} \dot x \\ \ddot x \\ \dot \phi \\ \ddot \phi \end{bmatrix} = \begin{bmatrix} 0 & 1 & 0 & 0 \\ 0 & \frac{-(I+ml^2)b}{I(M+m)+Mml²} & \frac{m^2gl^2}{I(M+m)+Mml^2} & 0 \\ 0 & 0 & 0 & 1 \\ 0 & \frac{-mlb}{I(M+m)+Mml^2} & \frac{mgl(M+m)}{I(M+m)+Mml^2} & 0 \end{bmatrix} \begin{bmatrix} x \\ \dot x \\ \phi \\ \dot \phi \end{bmatrix} + \begin{bmatrix} 0 \\ \frac{I+ml^2}{I(M+m)+Mml²} \\ 0 \\ \frac{ml}{I(M+m)+Mml^2} \end{bmatrix} u $$
$$ y = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} x \\ \dot x \\ \phi \\ \dot \phi \end{bmatrix} + \begin{bmatrix} 0 \\ 0 \end{bmatrix} u $$
The second approach does not start from the transfer functions but restarts fresh from the original linearized equations. Write them in matrix form as $$ \begin{bmatrix}I+ml^2&-ml\\-ml&M+m\end{bmatrix} \begin{bmatrix}\ddot ϕ\\\ddot x\end{bmatrix} + \begin{bmatrix}0&0\\0&b\end{bmatrix} \begin{bmatrix}\dot ϕ\\\dot x\end{bmatrix} + \begin{bmatrix}-mgl&0\\0&0\end{bmatrix} \begin{bmatrix}ϕ\\ x\end{bmatrix} = \begin{bmatrix}0\\ u\end{bmatrix} $$ and then as usual transform into a first order system by forming a phase space vector $$ \begin{bmatrix}I+ml^2&-ml&0&0\\-ml&M+m&0&0\\0&0&1&0\\0&0&0&1\end{bmatrix} \begin{bmatrix}\ddot ϕ\\\ddot x\\\dot ϕ\\\dot x\end{bmatrix} + \begin{bmatrix}0&0&-mgl&0\\0&b&0&0\\-1&0&0&0\\0&-1&0&0\\\end{bmatrix} \begin{bmatrix}\dot ϕ\\\dot x\\ϕ\\ x\end{bmatrix} = \begin{bmatrix}0\\ u\\0\\0\end{bmatrix} $$ Now multiply with the inverse of the first matrix to get an explicit first order system.