From differential equations to state-space and beyond

We have seen in Chapter 5 how to construct block-diagrams for simulation using integrators and, from there, derive state-space equations. The task was made easier if it was possible to use a chain of integrators, which led to a trivial definition of the state. In many cases that strategy is enough.

Recall that when you are given a differential equation
$$
\ddot{y} + a_1 y + a_2 y = b_2 u,
$$
in which no derivatives of the input appears or, equivalently, a transfer-function
$$
G(s) = \frac{b_2}{s^2+a_1 s+a_2},
$$
with no zeros, one can calculate relate $y$, $\dot{y}$ and $\ddot{y}$ through a chain of integrators, which leads to a state-space realization in which the state vector is comprised of the integrator outputs
$$
\begin{pmatrix}
x_1 \\ x_2
\end{pmatrix}
=
\begin{pmatrix}
y \\ \dot{y}
\end{pmatrix}.
$$
The corresponding simulation block-diagram is in the next figure.

A state-space representation is obtaining by solving for $\dot{x}_2 = \ddot{y}$, as in
$$
\dot{x}_2 =\ddot{y} = -a_1 y – a_2 y + b_2 u = -a_1 x_1 – a_2 x_2 + b_2 u
$$
and observing that
$$
\begin{aligned}
\dot{x}_1 &= \dot{y} = x_2, &
y &= x_1.
\end{aligned}
$$
The complete state-space realization is
$$
\begin{aligned}
\begin{pmatrix}
\dot{x}_1 \\ \dot{x}_2
\end{pmatrix}
&=
\begin{pmatrix}
x_2 \\ -a_1 x_1 – a_2 x_2 + b_2 u
\end{pmatrix}, \\
y &= x_1.
\end{aligned}
$$
which can be represented by the standard $A,B,C,D$ matrices as
$$
\begin{aligned}
\begin{pmatrix}
\dot{x}_1 \\ \dot{x}_2
\end{pmatrix}
&=
\begin{bmatrix}
0 & 1 \\ -a_1 & -a_2
\end{bmatrix}
\begin{pmatrix}
x_1 \\ x_2
\end{pmatrix}
+
\begin{bmatrix}
0 \\ b_2
\end{bmatrix}
u \\
y &= \begin{bmatrix}
1 & 0
\end{bmatrix}
\begin{pmatrix}
x_1 \\ x_2
\end{pmatrix}
+
0 u.
\end{aligned}
$$

The same strategy works for more complex systems, as long as there are no derivatives of the input involved in the equations. For example, the mass-spring-damper system from P5.26 is given by the differential equations
$$
\begin{aligned}
m_1 \ddot{z}_1 + (b_1 + b_2) \dot{z}_1 +
(k_1 + k_2) z_1 – b_2 \dot{z}_2 – k_2 z_2 &= 0, \\
m_2 \ddot{z}_2 + b_2 (\dot{z}_2 – \dot{z}_1) + k_2 (z_2 – z_1) &= f_2
\end{aligned}
$$
Note that if the force $u = f_2$ is the input, then no derivatives of the input appear in these equations. Therefore, one should be able to use a chain of integrators to realize the system. The resulting state is the vector
$$
\begin{pmatrix}
x_1 \\ x_2 \\ x_3 \\ x_4
\end{pmatrix}
=
\begin{pmatrix}
z_1 \\ \dot{z}_1 \\ z_2 \\ \dot{z}_2
\end{pmatrix},
$$
and the state-space equations are obtained by solving for the second-order derivatives
$$
\begin{aligned}
\dot{x}_2 = \ddot{z}_1 &= – \frac{k_1 + k_2}{m_1} z_1 -\frac{b_1 + b_2}{m_1} \dot{z}_1 + \frac{k_2}{m_1} z_2 + \frac{b_2}{m_1} \dot{z}_2, \\
&= – \frac{k_1 + k_2}{m_1} x_1 -\frac{b_1 + b_2}{m_1} x_2 + \frac{k_2}{m_1} x_3 + \frac{b_2}{m_1} x_4, \\
\dot{x}_4 = \ddot{z}_2 &= – \frac{k_2}{m_2} (z_2 – z_1) -\frac{b_2}{m_2} (\dot{z}_2 – \dot{z}_1) + \frac{1}{m_2} u, \\
&= – \frac{k_2}{m_2} (x_3 – x_1) -\frac{b_2}{m_2} (x_4 – x_2) + \frac{1}{m_2} u.
\end{aligned}
$$
If the output is $y = z_2 = x_3$ then
$$
\begin{aligned}
\dot{x}_1 &= \dot{z}_1 = x_2, &
\dot{x}_3 &= \dot{z}_2 = x_4, &
y &= x_1.
\end{aligned}
$$
Putting it all together
$$
\begin{aligned}
\begin{pmatrix}
\dot{x}_1 \\ \dot{x}_2 \\ \dot{x}_3 \\ \dot{x}_4
\end{pmatrix}
=
\begin{pmatrix}
x_2 \\
-\frac{k_1 + k_2}{m_1} x_1-\frac{b_1 + b_2}{m_1} x_2 + \frac{k_2}{m_1} x_3 + \frac{b_2}{m_1} x_4 + \\
x_4 \\
\frac{k_2}{m_2} x_1 + \frac{b_2}{m_2} x_2 – \frac{k_2}{m_2} x_3 – \frac{b_2}{m_2} x_4 + \frac{1}{m_2} u
\end{pmatrix}
\end{aligned}
$$
which can be represented by the standard $A,B,C,D$ matrices as
$$
\begin{aligned}
\begin{pmatrix}
\dot{x}_1 \\ \dot{x}_2 \\ \dot{x}_3 \\ \dot{x}_4
\end{pmatrix}
&=
\begin{bmatrix}
0 & 1 & 0 & 0 \\
-\frac{k_1 + k_2}{m_1} & -\frac{b_1 + b_2}{m_1} & \frac{k_2}{m_1} & \frac{b_2}{m_1} \\
0 & 0 & 0 & 1 \\
\frac{k_2}{m_2} & \frac{b_2}{m_2} & -\frac{k_2}{m_2} & -\frac{b_2}{m_2}
\end{bmatrix}
\begin{pmatrix}
x_1 \\ x_2 \\ x_3 \\ x_4
\end{pmatrix}
+
\begin{bmatrix}
0 \\ 0 \\ 0 \\ \frac{1}{m_2}
\end{bmatrix}
u \\
y &= \begin{bmatrix}
0 & 0 & 1 & 0
\end{bmatrix}
\begin{pmatrix}
x_1 \\ x_2 \\ x_3 \\ x_4
\end{pmatrix}
+
0 u.
\end{aligned}
$$

Having obtained the state-space matrices $(A,B,C,D)$ one can then use MATLAB or another computer tool to calculate properties of the system. For example

sys = ss(A,B,C,D)

creates a state-space system in MATLAB from which one can obtain the poles and zeros of the system with the commands

pole(sys)
zero(sys)

or the complete transfer-function by the command

tf(sys)

Note that state-space systems with different outputs can be easily produced by changing the $C$ matrix. For example, the system with output $y = z_1 = x_1$ has the same $A$ and $B$ matrices above and the matrix
$$
C = \begin{bmatrix} 1 & 0 & 0 & 0 \end{bmatrix}.
$$

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.