# Different state space models derived from the same differential equation

I hace come accross the book "Robust Adaptive Control" from the authors "Petros A. Ioannou" & "Jing Sun". There is a free PDF version of the book at the webpage of one of the authors if anyone is interested. At page 457 there is a transfer function of the form:

$$Y(s) = \frac{b(s+1)}{(s+a)s}U(s)$$

which is converted to the differential equation:

$$\ddot{y}+a\dot{y}=b\dot{u}+bu$$

I convert into a state space form by following the below classical procedure:

$$x_1 = y \ \Rightarrow \ \dot{x_1} = x_2$$

$$x_2 = \dot{y} - bu \ \Rightarrow \ \dot{x_2} = -a(x_2+bu)+b\dot{u}+bu-b\dot{u} \ \Rightarrow \ \dot{x_2} = -ax_2+b(1-a)u$$

The state-space matrix form is:

$$\dot{x} = \begin{bmatrix}0 & 1\\0 & -a\end{bmatrix}x+\begin{bmatrix}b\\b(1-a)\end{bmatrix}u$$

$$y = \begin{bmatrix}1 & 0\end{bmatrix}x$$

However, the author obtains another state-space form which also is right for this particular transfer function (I tested it with MATLAB) it is this one:

$$\dot{x} = \begin{bmatrix}-a & 1\\0 & 0\end{bmatrix}x+\begin{bmatrix}b\\b\end{bmatrix}u$$

$$y = \begin{bmatrix}1 & 0\end{bmatrix}x$$

I tried to "reverse engineer" to figure out which state variables he chose but was unable to do so. For example, I thought this:

$$$$x_2 = \dot{y}+ay-bu \ \Rightarrow \ \dot{x_2} = \ddot{y}+a\dot{y}-b\dot{u}$$$$

and by replacing $$\ddot{y}$$ from the differential equation we get $$\dot{x_2}=bu$$ which is the state space equation derived at the book. But this gets me nowhere regarding the choice of state variable $$x_1$$. Could use some help here.

Let us have a system defined by the general differential equation: $$\frac{d^n y}{dt^n} + p_1 \frac{d^{n-1} y}{dt^{n-1}} + \cdots p_{n-1} \frac{d y}{dt} + p_n y = q_0 \frac{d^n u}{dt^n} + q_1 \frac{d^{n-1} u}{dt^{n-1}} + \cdots q_{n-1} \frac{d u}{dt} + q_n u$$ where $$u$$ is the input and $$y$$ is the output.

For the case that you are studying, $$n = 2$$, and the corresponding differential equation becomes: $$\frac{d^2 y}{dt^2} + p_1 \frac{d y}{dt} + p_2 y = q_0 \frac{d^n u}{dt^n} + q_1 \frac{d^{n-1} u}{dt^{n-1}} + \cdots q_{n-1} \frac{du}{dt} + q_n u$$ where the coefficients are: $$p_1 = a$$, $$p_2 = 0$$, $$q_0 = 0$$, $$q_1 = q_2 = b$$.

Taking Laplace transform on both sides results in: $$(s^2 + p_1 s + p_2) Y(s) = (q_0 s^2 + q_1 s + q_2) U(s)$$

Rearrange the equation by collating the terms containing $$s^2$$, $$s$$ and $$s^0$$ (or 1) such that: $$s^2 (Y(s) - q_0 U(s)) + s(p_1 Y(s) - q_1 U(s)) + (p_2 Y(s) - q_2 U(s)) = 0$$

Dividing both sides by $$s^2$$ and transposing terms in $$s$$ to the right: \begin{align} Y(s) &= q_0 U(s)) + \frac{1}{s}\left(q_1 U(s) - p_1 Y(s) \right) + \frac{1}{s^2}\left(q_2 U(s) - p_2 Y(s) \right) \\ \text{or, } Y(s) &= q_0 U(s)) + \frac{1}{s}\left(q_1 U(s) - p_1 Y(s)+ \frac{1}{s}\left(q_2 U(s) - p_2 Y(s) \right) \right) \end{align}

Take, $$Y(s) = q_0 U(s) + X_1(s)$$, where $$X_1(s) = \frac{1}{s}\left(q_1 U(s) - p_1 Y(s) + \frac{1}{s}\left(q_2 U(s) - p_2 Y(s) \right) \right)$$

Now, write $$X_1(s) = \frac{1}{s}\left(q_1 U(s) - p_1 Y(s) + X_2(s)\right)$$ such that $$X_2(s) = \frac{1}{s}\left(q_2 U(s) - p_2 Y(s) \right)$$

Substituting $$Y(s)$$ in the expression for $$X_1(s)$$ and also multiply both sides by $$s$$, we get $$sX_1(s) = q_1 U(s)- p_1 (q_0 U(s) + X_1(s)) + X_2(s)$$ $$\therefore sX_1(s) = - p_1 X_1(s) + X_2(s) + (q_1- p_1 q_0) U(s)$$

Taking inverse Laplace transform (L.T.) of the above, we get $$\dot{x_1} = - p_1 x_1 + x_2 + (q_1- p_1 q_0) u$$

Similarly, upon substituting $$Y(s)$$ in the expression for $$X_2(s)$$ and multiplying by $$s$$ on both sides, we get $$sX_2(s) = q_2 U(s) - p_2 (q_0 U(s) + X_1(s))$$ $$\therefore sX_2(s) = - p_2 X_1(s) + (q_2 - p_2 q_0) U(s)$$ Taking inverse L.T. of the above, we obtain $$\dot{x_2} = -p_2 x_1 + (q_2 - p_2 q_0) u$$

Also, take inverse L.T. of the expression for $$Y(s)$$ to get: $$y = q_0 u + x_1$$ Now, substitute the values for $$p_1 = a,~p_2 = 0,~q_0 = 0,~q_1 = b$$ and $$q_2 = b$$ to get the following state equations: \begin{align} \dot{x_1} &= -ax_1 + x_2 + bu \\ \dot{x_2} &= bu \\ y &= x_1 \end{align}

In state-space form, $$\begin{gather} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} -a & 1 \\ 0 & 0 \end{bmatrix} + \begin{bmatrix} b\\ b \end{bmatrix} u \\ y = \begin{bmatrix} 1 & 0 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} \end{gather}$$

This form of the state-space equation is also known as observable canonical form. You could read more about it in Chapter 9 of the book: Modern Control Engineering (Fifth edition) by Katsuhiko Ogata.

• Thank you for the answer, this is what is happening. If you want my advice try to keep your posts as clear as possible since your answer is somehow difficult to be read due to the whole bunch of equations, friendly speaking :) Commented Apr 28, 2020 at 16:53
• Thanks for your advice. Hope the answer helped you. I tried to keep the equations to the minimum. However I wanted the answer to be complete. But, as you know, state space modelling is all about mathematics.... Commented Apr 28, 2020 at 23:58
• Answer was great and thank you for that ! Commented Apr 29, 2020 at 0:48