Part 5 - Space-state representation (1)

Posted on Nov 7, 2023
(Last updated: May 26, 2024)

Introduction

In this part we’ll see how we can represent systems using matrix notation, also called space-state representation. Along with how we linearize non-linear systems.

State variables

If we use the spring-mass system from last time, with $F_d$ as input signal and $y$ as output signal.

We obtained the following differential equation: $$ \ddot{y} = \dfrac{1}{m}(F_d - b\dot{y} - ky) $$

If we want to represent this system using a set of first-order differential equations instead, we can do the following:

Let $x_1 = y(t)$ and $x_2 = \dot{y}(t)$.

Then we can write: $$ \begin{cases} \dot{x_1} = x_2 \\ \dot{x_2} = \dfrac{1}{m}(F_d - b\dot{y} - ky) \end{cases} $$

Let’s now call the input signal, $F_d$, for $u$. $$ \begin{cases} \dot{x_1} = x_2 \\ \dot{x_2} = \dfrac{1}{m}(u - b\dot{y} - ky) \end{cases} $$

In matrix notation we can write it as: $$ \begin{bmatrix} \dot{x_1} \\ \dot{x_2} \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ -\dfrac{k}{m} & -\dfrac{b}{m} \\ \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} + \begin{bmatrix} 0 \\ \dfrac{1}{m} \end{bmatrix} u $$

We say that $A = \begin{bmatrix} 0 & 1 \\ -\dfrac{k}{m} & -\dfrac{b}{m} \\ \end{bmatrix}$ is the system matrix.

Therefore, we can finally write it as: $$ \begin{cases} \dot{x} = Ax + Bu \\ y = x_1 \end{cases} $$

Linearization

Is a quite simple concept is the first order Taylor expansion around a point. Let’s take a look for functions of one variable.

We want to linearize around the point $x = x_0$: $$ f(x) \approx f(x_0) + f^\prime(x_0)(x - x_0) $$

In Control theory, the linearized function is quite often not the interest itself. Rather we want to understand how much this linear approximation deviates from the desired value.

So we say that: $$ \Delta f = f(x) - f(x_0) = f^\prime(x_0)(x - x_0) = \boxed{f^\prime(x_0)\Delta x} $$

For functions of 2 (or more variables), around point $(x_0, y_0)$: $$ f(x, y) \approx f(x_0, y_0) + \dfrac{\partial f}{\partial x} \biggr\rvert_{(x_0, y_0)} \Delta x + \dfrac{\partial f}{\partial y} \biggr\rvert_{(x_0, y_0)} \Delta y $$

Which means: $$ \Delta f(x, y) = \dfrac{\partial f}{\partial x} \biggr\rvert_{(x_0, y_0)} \Delta x + \dfrac{\partial f}{\partial y} \biggr\rvert_{(x_0, y_0)} \Delta y $$

Example tank system

From the last part, we had a tank system which we described with a differential equation. Say that we have a point of equilibrium, $(q_0, h_0)$ meaning that $h = 0$.

This gives us that $\dot{h}(q_0, h_0) = f(q_0, h_0) = 0$

$$ q_0 = a \sqrt{2g} \cdot \sqrt{h_0} $$

$$ a \sqrt{2g} = \dfrac{q_0}{\sqrt{h_0}} $$

We’ll use this later on, but let’s first linearize what we had. $$ \dfrac{\partial f}{\partial q_{in}} \biggr\rvert_{(q_0, h_0)} = \dfrac{1}{A} $$

$$ \dfrac{\partial f}{\partial h_{1}} \biggr\rvert_{(q_0, h_0)} = \ldots = -\dfrac{q_0}{2Ah_0} $$

This means that: $$ \Delta f(q_{in}, h_1) \approx \dfrac{1}{A} \Delta q - \dfrac{q_0}{2Ah_0} \Delta h $$

Which is the same as: $$ \Delta \dot{h} \approx \dfrac{1}{A} \Delta q - \dfrac{q_0}{2Ah_0} \Delta h $$

If we now take the Laplace transform: $$ s \Delta H(s) = \dfrac{1}{A} \Delta Q(s) - \dfrac{q_0}{2Ah_0} \Delta H(s) $$

$$ (s + \dfrac{q_0}{2Ah_0}) \Delta H(s) = \dfrac{1}{A} \Delta Q(s) $$

Let’s now find the transfer function from $q_{in}\to h_1$ $$ G_{qh}(s) = \dfrac{\Delta H(s)}{\Delta Q(s)} = \dfrac{\dfrac{1}{A}}{s + \dfrac{q_0}{2Ah_0}} $$

We can rewrite it as: $$ G_{qh}(s) = \dfrac{2h_0}{s2Ah_0 + q_0} \ | \cdot 2Ah_0 $$

$$ G_{qh}(s) = \dfrac{\dfrac{2h_0}{q_0}}{s\dfrac{2Ah_0}{q_0} + 1} \ | \div q_0 $$

Let $K = \dfrac{2h_0}{q_0}$ and $T = \dfrac{2Ah_0}{q_0}$ $$ G_{qh}(s) = \dfrac{K}{1 + sT} \ | \div q_0 $$