I know generally, we transform differential equations into the space-state representation by substituting the derivatives with the states.
However, I would need the opposite - given the state space representation to arrive at the differential equation format (in order to design a PID controller).
$$ \dot x_{1}=-x_{1}+x_{2} $$ $$ \dot x_{2}=-x_{1}+u $$
$$ A\begin{pmatrix} -1 & 1 \\ -1 & 0 \\ \end{pmatrix}x \quad B\begin{pmatrix} 0 \\ 1 \\ \end{pmatrix}u $$
As one differential equation has multiple ways to be represented in state-space I am unsure how this works in the opposite way.
Any advice?
Thanks in advance,
For this specific example, \begin{align} \begin{split} \dot{x}_1 &= -x_1 + x_2 \\ \dot{x}_2 &= -x_1 + u \end{split} \implies \begin{split} \ddot{x}_1 &= -\dot{x}_1 + \dot{x}_2 \\ \dot{x}_2 &= \underline{-x_1 + u} \end{split} \implies \ddot{x}_1 = -\dot{x}_1 + \underline{u - x_1} \implies \ddot{x}_1 + \dot{x}_1 + x_1 = u \end{align} where we substituted $\dot{x}_2$ (the underlined equation) into $\ddot{x}_1$. In general, if you have a single input single output system of the form, \begin{align} \begin{split} \dot{x} &= Ax + B u \\ y &= Cx + Du \end{split} \end{align} You can compute the transfer function $G(s) = C(sI - A)^{-1}B + D$. Let $G(s) = \frac{P(s)}{Q(s)}$ where $P(s)$ is a polynomial of $s$ in the numerator and $Q(s)$ is a polynomial of $s$ in the denominator of $G(s)$. Then from $Y(s) = G(s)U(s) = \frac{P(s)}{Q(s)}U(s)$ we can get $Q(s)Y(s) = P(s)U(s)$ and by taking the inverse Laplace transform we can obtain the differential equation, i.e., $\mathcal{L}^{-1}(Q(s)Y(s)) = \mathcal{L}^{-1}(P(s)U(s))$. For your example, \begin{align} A = \begin{bmatrix}-1 & 1 \\ -1 & 0\end{bmatrix} \quad B = \begin{bmatrix}0 \\ 1\end{bmatrix} \quad C = \begin{bmatrix}1 & 0\end{bmatrix} \quad D = 0 \end{align} Therefore, \begin{align} C(sI - A)^{-1}B + D = \begin{bmatrix}1 & 0\end{bmatrix}\begin{bmatrix}s+1 & -1 \\ 1 & s\end{bmatrix}^{-1}\begin{bmatrix}0 \\ 1\end{bmatrix} = \frac{1}{s^2+s+1} \end{align} and from the transfer function we can obtain, \begin{align} Y(s) = \frac{1}{s^2+s+1} U(s) \implies (s^2+s+1)Y(s) = U(s) \overset{\mathcal{L}^{-1}}{\implies} \ddot{y} + \dot{y} + y = u \end{align} Since $y=x_1$ we can write this as $\ddot{x}_1 + \dot{x}_1 + x_1 = u$ (same as above).