Let's say we have a linear system, for example, a system tracking the movement of two groups of animals, and we want to find the stability of the system and its fixed points, but before we can do this, we need to put the system into its state-space form. It should be noted, there are many uses for state-space forms, but this is a common example for its use in engineering. Let's get started!
Let there be a linear system made up by Eqs. (1-2):
[ 1 ]
$$ \ddot{\theta} + 2 \dot{\theta} + \theta = - u(t) $$
[ 2 ]
$$ \dot{\alpha} - \frac{1}{2} \dot{\theta} + \frac{1}{2} \alpha = \frac{1}{3} u(t) $$
Now we want to put the system in its state-space form. The first step is to define our variables as $ x_1 $, $ x_2 $, and $ x_3 $. The reason we are using 3 x variables here is because we have two different variables: $ \theta $ and $ \alpha $, $ \theta $ with a highest derivative as a double, $ \ddot{\theta} $, and $ \alpha $ with a highest derivative of a single, $ \dot{\alpha} $.
What I like to do is sum the highest derivatives of each variable and add them together to get the number of x values needed to describe the system. Hence, we have 2 x's from the $ \theta $ and 1 x from the $ \alpha $, giving a total of 3 x's needed. Now that we have our numbers of x's, we can then define them. Let's do this first, then discuss.
[ 3 ]
$$ x_1 = \theta $$ $$ x_2 = \dot{\theta} $$ $$ x_3 = \alpha $$
Notice above that we allocated two x's towards $ \theta $ and one x toward $ \alpha $. Now remember, we will take the highest derivative of each variable for our system and that will be the number of x's allocated to that variable, hence why $ \theta $ has 2 x's and $ \alpha $ has 1 x. One x is denoted as $ \theta $ and the other is denoted as $ \dot{\theta} $ because we are trying to avoid having a second derivative in our system to make it simpler to solve; this is the whole point of what we are doing, to make a problem easier on us in the end!
The next step is to then replace our variables in the system.
[ 4 ]
$$ \dot{x_1} = x_2 $$
[ 5 ]
$$ \dot{x_2} + 2x_2 + x_1 = -u(t) $$
[ 6 ]
$$ \dot{x_3} - \frac{1}{2} x_2 + \frac{1}{2} x_3 = \frac{1}{3} u(t) $$
Once we have made the substitutions, we want to isolate our $ x_1 $, $ x_2 $, and $ x_3 $ in their perspective equations. We can do this for Eq. (4-6):
[ 7 ]
$$ \dot{x_1} = x_2 $$ $$ \dot{x_2} = -2x_2 - x_1 -u(t) $$ $$ \dot{x_3} = \frac{1}{2} x_2 - \frac{1}{2} x_3 + \frac{1}{3} u(t) $$
And now we start to form our state-space form for the linear system!
We will follow the form
[ 8 ]
$$ \dot{x} = \mathbf{A} x + \mathbf{B} u(t) $$
where $ \dot{x} $ is an array of the first derivatives of the x variables we defined in Eq. (3), $ \mathbf{A} $ is the Jacobian matrix, where the system's main information is stored, and $ \mathbf{B} u(t) $ are the external inputs to the system. Putting this all together, we will get
[ 9 ]
$$ \begin{Bmatrix} \dot{x_1} \\ \dot{x_2} \\ \dot{x_3} \end{Bmatrix} = \begin{bmatrix} 0 & 1 & 0 \\ -1 & -2 & 0 \\ 0 & \frac{1}{2} & -\frac{1}{2} \end{bmatrix} \begin{Bmatrix} x_1 \\ x_2 \\ x_3 \end{Bmatrix} + \begin{Bmatrix} 0 \\ -1 \\ \frac{1}{3} \end{Bmatrix} u(t) $$
Now we have our system in its state-space form! There are several ways to get information from the Jacobian matrix, $ \mathbf{A} $, such as the stability and fixed points of the system. This will be for another tutorial though!