# State space transformation

I have some governing equations of the form:

\begin{align} \ddot \theta(t) &= \frac{MgL + mgl}{J} \theta(t) + \frac B J \dot x(t) - \frac \alpha J V + \frac {mg}{J} d - \frac{c_1}{J} \dot \theta(t) \\ \ddot x &= \frac{\alpha}{R(M+m)} V - \frac{\beta/R + c_2}{M+m} \dot x(t) \end{align} \tag 1

And I would like to transform them to the state space. I'd like them final equation to take the form of $$\dot z(t) = Az(t)+Bu(t)+T$$, where $$z(t) = (\theta, \dot \theta, \dot x)$$ is the state vector. And I'd like for $$U$$ to contain $$V$$ and for $$T$$ to be a vector containing the disturbance torque $$mgd/J$$.

How would I go about this? I'm having trouble conceptualizing the internal relationships between the states. How would I write the governing equations in state space form?

And for the measurements, Id like to measure all three states.

• It's not as painful as one might imagine, but I really wish that every poster uses $\LaTeX$ math markup instead of posting pictures of equations. There is even a Stack Exchange for it. Jun 20, 2023 at 2:32
• Sometimes if you're a newbie, someone will come along and do it for you -- once. Jun 20, 2023 at 3:01
• I believe you want $z(t) = \begin{bmatrix} \dot \theta & \theta & \dot x \end{bmatrix}^T$. If so, where you want that to appear, edit your question with $z(t) = \begin{bmatrix} \dot \theta & \theta & \dot x \end{bmatrix}^T$. Jun 20, 2023 at 3:06
• @TimWescott I have done that for a couple of newbies. But this was a much bigger job and I didn't wanna research how to do single or double dot. Jun 20, 2023 at 3:34
• $\ddot \theta$ = $\ddot \theta$. Jun 20, 2023 at 14:34

Start with $$z(t) = \begin{bmatrix} \dot \theta & \theta & \dot x \end{bmatrix}^T$$. Take it's derivative: $$\frac d {dt} z(t) = \begin{bmatrix}\dot \theta \\ \theta \\ \dot x\end{bmatrix} = \begin{bmatrix}\ddot \theta \\ \dot \theta \\ \ddot x\end{bmatrix}$$
Now add the $$\frac{d}{dt} \theta$$ term to your (1): \begin{align} \ddot \theta(t) &= \frac{MgL + mgl}{J} \theta(t) + \frac B J \dot x(t) - \frac \alpha J V + \frac {mg}{J} d - \frac{c_1}{J} \dot \theta(t) \\ \dot \theta &= \dot \theta \\ \ddot x &= \frac{\alpha}{R(M+m)} V - \frac{\beta/R + c_2}{M+m} \dot x(t) \end{align}
You should be able to pick out $$\mathbf A$$ by inspection:
$$\frac{d}{dt} \begin{bmatrix}\dot \theta \\ \theta \\ \dot x\end{bmatrix} = \begin{bmatrix} - \frac{c_1}{J} & \frac{MgL + mgl}{J} & \frac B J \\ 1 & 0 & 0 \\ 0 & 0 & - \frac{\beta/R + c_2}{M+m} \end{bmatrix} \begin{bmatrix}\dot \theta \\ \theta \\ \dot x\end{bmatrix} + \begin{bmatrix} - \frac \alpha J V + \frac {mg}{J} d \\ 0 \\ \frac{\alpha}{R(M+m)} V \end{bmatrix}$$