Dynamic Systems:

State Space


By Prof. Seungchul Lee
http://iai.postech.ac.kr/
Industrial AI Lab at POSTECH

Table of Contents

1. State of a Dynamic System


  • A minimum set of variables, known as state variables, that fully describe the system and its response to any given set of inputs.



  • If the system is state-determined, knowledge of its state variables $\vec{x}^T = [x_1(t_0), x_2(t_0), \cdots , x_n(t_0)]^T$ at some initial time $t_0$, and its inputs $\vec{u}(t)$ for $t \geq t_0$ is sufficient to determine all future behavior of the system.
  • The number of state variables, $n$, is equal to the number of independent "energy storage elements" in the system.
  • The state equations


$$ \dot{x_1} = f_1(x, u, t) \\ \dot{x_2} = f_2(x, u, t) \\ \vdots \\ \dot{x_n} = f_n(x, u, t) $$

  • We restrict attention primarily to linear and time-invariant (LTI) system. Then it becomes a set of $n$ coupled first-order linear differential equations with constant coefficients.


$$ \dot{x_1} = a_{11}x_1 + \cdots + a_{1n}x_n \;+\; b_{11}u_1 + \cdots + b_{1p}u_p \\ \dot{x_2} = a_{21}x_1 + \cdots + a_{2n}x_n \;+\; b_{21}u_1 + \cdots + b_{2p}u_p \\ \vdots \\ \dot{x_n} = a_{n1}x_1 + \cdots + a_{nn}x_n \;+\; b_{n1}u_1 + \cdots + b_{np}u_p $$

  • Written compactly in a matrix form


$$ {d \over d t} \begin{bmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{bmatrix} = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ & & \vdots \\ & & \vdots \\ & & & a_{nn} \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{bmatrix} \;+\; \begin{bmatrix} b_{11} & b_{12} & \cdots & b_{1p} \\ & & \vdots \\ & & \vdots \\ & & & b_{np} \end{bmatrix} \begin{bmatrix} u_1 \\ u_2 \\ \vdots \\ u_p \end{bmatrix} $$

  • Which may be summarized as


$$\dot{x} = Ax + Bu$$

  • Output equations


$$ y_1 = c_{11}x_1 + \cdots + c_{1n}x_n \;+\; d_{11}u_1 + \cdots + d_{1p}u_p \\ y_2 = c_{21}x_1 + \cdots + c_{2n}x_n \;+\; d_{21}u_1 + \cdots + d_{2p}u_p \\ \vdots \\ y_q = c_{q1}x_1 + \cdots + c_{qn}x_n \;+\; d_{q1}u_1 + \cdots + d_{qp}u_p \\ $$

  • or in a matrix form


$$ \begin{bmatrix} y_1 \\ y_2 \\ \vdots \\ y_q \end{bmatrix} = \begin{bmatrix} c_{11} & c_{12} & \cdots & c_{1n} \\ & & \vdots \\ & & \vdots \\ & & & c_{qn} \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{bmatrix} \;+\; \begin{bmatrix} d_{11} & d_{12} & \cdots & d_{1p} \\ & & \vdots \\ & & \vdots \\ & & & d_{qp} \end{bmatrix} \begin{bmatrix} u_1 \\ u_2 \\ \vdots \\ u_p \end{bmatrix} $$

$$\begin{align*}y &= Cx+Du \qquad \text{or}\\ y &= Cx \qquad \qquad \,\text{for many physical systems the matrix} \; D \; \text{is the null matrix} \end{align*}$$


  • The complete system model for LTI system in the standard state space form


$$ \dot{x} = Ax + Bu \\ y = Cx + Du $$


  • Block diagram



2. Homogeneous State Response

With zero input, $u(t) = 0$


$$ \begin{align*} \dot{x} &= Ax \end{align*} $$


$$ y(t) = e^{At}x\left( 0 \right) $$

Let's figure out how such a system behaves

  • Start by ignoring the input term:
$$ \begin{align*} \dot{x} &= Ax\\ x(t_0) &= x_0 \end{align*} $$

What is the solution to this system?

  • If everything is scalar:
$$\dot{x} = a x, \quad x(t_0) = x_0 \implies x(t) = e^{at}x_0$$
  • How do we know?
$$ \begin{align*} x(0) &= e^{0}x_0 = x_0 \\ \frac{dx(t)}{dt} &= a e^{at}x_0 = ax(t) \end{align*} $$



For higher-order systems, we just get a matrix version of this


$$\dot{x} = Ax, \quad x(0) = x_0 \implies x(t) = e^{At}x_0$$
  • The definition is just like for scalar exponentials
$$e^{at} = \sum_{k=0}^{\infty}\frac{(at)^k}{k!}, \qquad e^{At} = \sum_{k=0}^{\infty}\frac{(At)^k}{k!}$$
  • Derivative:
$$\frac{d}{dt}e^{At} = \frac{d}{dt} \sum_{k=0}^{\infty} \frac{(At)^k}{k!} = 0 + \sum_{k=1}^{\infty} \frac{kA^kt^{k-1}}{k!} = A\sum_{k=1}^{\infty} \frac{(At)^{k-1}}{(k-1)!} = A \sum_{k=0}^{\infty} \frac{(At)^k}{k!} = A e^{At}$$



The matrix exponential plays such an important role that it has its own name: the state transition matrix, $\Phi(t)$


$$\dot{x} = Ax \quad \implies \quad \begin{align*}x(t) &= \Phi (t)x(0)\\\\e^{At} &= \Phi(t)\end{align*}$$


  • Properties of state transition matrix
    • $\Phi(0) = I$
    • $\Phi(-t) = \Phi^{-1}(t)$
    • $\Phi(t_1 + t_2) = \Phi(t_1)\Phi(t_2)$


$$ \begin{align*} x(0) &= \Phi(-t_0)x(t_0)\\\\ x(t) = \Phi(t)x(0) &= \Phi(t)\Phi(-t_0)x(t_0) \\ &= \Phi(t-t_0)x(t_0) \end{align*} $$
  • Example
$$\dot{x} = \begin{bmatrix} -2 & 0 \\ 1 & -1 \end{bmatrix}x, \qquad x(0) = \begin{bmatrix} 2 \\ 3 \end{bmatrix}$$



$$\Phi(t) = e^{At} = Se^{\Lambda t}S^{-1}$$



$$ \begin{align*} \lambda_1 = -2 \quad &\implies \quad \begin{bmatrix} 0 & 0 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} \begin{bmatrix} 0 \\ 0 \end{bmatrix} \quad &\implies \quad \vec{x}_1 = \begin{bmatrix} 1 \\ -1 \end{bmatrix} \\\\ \lambda_2 = -1 \quad &\implies \quad \begin{bmatrix} -1 & 0 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} \begin{bmatrix} 0 \\ 0 \end{bmatrix} \quad &\implies \quad \vec{x}_2 = \begin{bmatrix} 0 \\ 1 \end{bmatrix} \end{align*} $$



$$ e^{\Lambda t} = \begin{bmatrix} e^{-2t} & 0 \\ 0 & e^{-t} \end{bmatrix}, \qquad S = \begin{bmatrix} 1 & 0 \\ -1 & 1 \end{bmatrix}, \qquad S^{-1} = \begin{bmatrix} 1 & 0 \\ 1 & 1 \end{bmatrix} $$



$$ x(t) = Se^{\Lambda t}S^{-1}x(0) = \begin{bmatrix} 1 & 0 \\ -1 & 1 \end{bmatrix} \begin{bmatrix} e^{-2t} & 0 \\ 0 & e^{-t} \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} 2 \\ 3 \end{bmatrix} = \begin{bmatrix} 2e^{-2t} \\ 5e^{-t} - 2e^{-2t} \end{bmatrix} $$
In [1]:
% method 2: use 'lsim'

A = [-2, 0; 1, -1];
B = [0, 0]';
C = [1, 0;
     0, 1];
D = 0;

G = ss(A,B,C,D);

x0 = [2; 3];

t = linspace(0,10,500);
u = zeros(size(t));

[y, tout] = lsim(G,u,t,x0);

plot(tout,y,tout,zeros(size(tout)),'k--')
xlabel('time')
legend('x_1', 'x_2')

3. Forced State Response of LTI System

But what if we have the controlled system: $\dot{x} = Ax + Bu$

  • Consider the complete response of a linear system to an input $u(t)$
$$\dot{x}(t) - ax(t) = bu(t)$$
  • Derivation
$$e^{-at}\dot{x} - e^{-at}ax = {d \over dt}(e^{-at}x(t)) = e^{-at}bu$$$$\int^t_0{d \over d\tau}(e^{-a\tau}x(\tau))d\tau = e^{-at}x(t) - x(0) = \int^t_0e^{-a\tau}bu(\tau)d\tau$$
  • Complete solution
$$x(t) = e^{at}x(0) + \int^t_0e^{a(t-\tau)}bu(\tau)d\tau$$


3.1. For Higher Order Systems


$$\dot{x} = Ax + Bu$$
  • Complete solution
$$x(t) = e^{At}x(0) + \int^t_0e^{A(t-\tau)}Bu(\tau)d\tau$$
  • the output
$$ \begin{align*} y &= Cx + Du \\ y(t) &= Ce^{At}x(0) + C\int^t_0e^{A(t-\tau)}Bu(\tau)d\tau + Du(t) \end{align*} $$
  • $Ce^{At}x(0)$ is the initial response
    • The first is a term similar to the system homogeneous response $x_h(t) = e^{At}x(0)$ that is dependent only on the system initial conditions $x(0)$
  • $Ce^{At}B$ is the impulse response of the system
    • The second term is in the form of a convolution integral, and it is the particular solution for the input $u(t)$ with zero initial conditions


  • Note


$$ \begin{align*} x(t) &= \Phi(t) x(0) + \int_{0}^{t} \Phi(t-\tau) Bu(\tau) d\tau\\ \\ x(0) &= \Phi(0) x(0) + \int_{0}^{0} \Phi(0-\tau) Bu(\tau) d\tau = x(0)\\ \\ \frac{d}{dt} \int_{t_0}^{t} f(t,\tau) d \tau &= f(t,t) + \int_{t_0}^{t} \frac{\partial f(t,\tau)}{\partial t} d \tau \\ & \implies \Phi(0)Bu(t) + \int_{t_0}^{t} A \Phi(t-\tau)Bu(\tau) d \tau\\ \\ \frac{d}{dt}x(t) &= A\left(\Phi(t)x(0) + \int_{t_0}^{t} \Phi(t-\tau)Bu(\tau) d \tau \right) + Bu(t)\\ \frac{d}{dt}x(t) &= Ax + Bu \end{align*} $$
  • Example
$$ \begin{bmatrix} \dot{x}_1 \\ \dot{x}_2 \end{bmatrix} = \begin{bmatrix} -2 & 0 \\ 1 & -1 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} + \begin{bmatrix} 1 \\ 0 \end{bmatrix}u, \qquad u = 2u(t) \;\;\text{where} \; u(t)\; \text{is a step function}, \quad x(0) = \begin{bmatrix} 0 \\ 0 \end{bmatrix} $$


$$ \Phi(t) = \begin{bmatrix} e^{-2t} & 0 \\ e^{-t} - e^{-2t} & e^{-t} \end{bmatrix} = e^{At} $$


$$ \begin{align*} x(t) &= \int^t_0 e^{A(t-\tau)}Bu(\tau)d\tau= e^{At} \int^t_0 e^{-A\tau}Bu(\tau)d\tau = \Phi(t) \int^t_0 \Phi(-\tau)B \, 2 d\tau \\ \\ &= \begin{bmatrix} e^{-2t} & 0 \\ e^{-t} - e^{-2t} & e^{-t} \end{bmatrix} \int^t_0 \begin{bmatrix} e^{2\tau} & 0 \\ e^{\tau} - e^{2\tau} & e^{\tau} \end{bmatrix} \begin{bmatrix} 2 \\ 0 \end{bmatrix} d\tau \\ &= \begin{bmatrix} e^{-2t} & 0 \\ e^{-t} - e^{-2t} & e^{-t} \end{bmatrix} \int^t_0 \begin{bmatrix} 2e^{2\tau} \\ 2e^{\tau} - 2e^{2\tau} \end{bmatrix} d\tau \\ &= \begin{bmatrix} e^{-2t} & 0 \\ e^{-t} - e^{-2t} & e^{-t} \end{bmatrix} \begin{bmatrix} e^{2\tau} \big\rvert^t_0 \\ (2e^\tau - e^{2\tau}) \big\vert^t_0 \end{bmatrix} \\ &= \begin{bmatrix} e^{-2t} & 0 \\ e^{-t} - e^{-2t} & e^{-t} \end{bmatrix} \begin{bmatrix} e^{2t} -1 \\ 2e^t - e^{2t} -1 \end{bmatrix} \\ &= \begin{bmatrix} 1 - e^{-2t} \\ (e^{-t} - e^{-2t})(e^{2t} - 1) + e^{-t}(2e^t - e^{2t} - 1) \end{bmatrix} \\\\ &= \begin{bmatrix} 1 - e^{-2t} \\ 1 + e^{-2t} \end{bmatrix} \end{align*} $$

Note: Leibniz Integral Rule

If $\mathbf{F}(t) = \int_{a(t)}^{b(t)} f(t, \tau) d \tau$, then

$$\frac{d \mathbf{F}}{d t} = \int_{a(t)}^{b(t)} \frac{\partial f(t, \tau)}{\partial t} d \tau + f(t, b(t)) \frac{d b}{d t} - f(t, a(t)) \frac{d a}{d t}$$


Proof.

Suppose $f$ is a univariate function


$$ \begin{align*} F(t) = \int_{t_0}^{t} f(\tau) d \tau &\quad \implies \quad \frac{d F (t)}{d t} = f(t) \\\\ F(t) = \int_{t}^{t_0} f(\tau) d \tau &\quad \implies \quad \frac{d F (t)}{d t} = -f(t) \end{align*} $$

Now suppose $f$ is a function of two variables ($a$ and $b$ are constant)


$$ \begin{align*} F(t) = \int_{a}^{b} f(t, \tau) d \tau \quad \implies \quad \frac{d F(t)}{d t} = \int_{a}^{b} \frac{\partial f(t, \tau)}{\partial t} d \tau \end{align*} $$

Now suppose the limits of integration $a$ and $b$ themselves depend on $t$,


$$\mathbf{F}(t) = F(t, a(t), b(t)) = \int_{a(t)}^{b(t)} f(t, \tau) d \tau$$

$$ \begin{align*} \frac{d \mathbf{F}(t)}{d t} &= \frac{\partial F}{\partial t} + \frac{\partial F}{\partial a} \frac{d a}{d t} + \frac{\partial F}{\partial b}\frac{d b}{d t} \\\\ &= \int_{a(t)}^{b(t)} \frac{\partial f(t, \tau)}{\partial t} d \tau + f(t, b(t))\frac{d b}{d t} - f(t,a(t))\frac{d a}{d t}\\\\ \frac{d}{dt} \int_{t_0}^{t} f(t,\tau) d \tau &= \int_{t_0}^{t} \frac{\partial f(t,\tau)}{\partial t} d \tau + f(t,t) \end{align*} $$

3.2. The Response of LTI to the Singularity Input Functions


$$x(t) = e^{At}x(0) + \int^t_0 e^{A(t - \tau)} Bu(\tau)d\tau$$


Impulse response


$$u(t) = K\delta(t) = \begin{bmatrix} k_1 \\ k_2 \\ \vdots \\ k_p \end{bmatrix} \delta(t) $$


$$ \begin{align*} x(t) &= e^{At}x(0) + \int^t_0 e^{A(t-\tau)}BK\delta(\tau)d\tau \\\\ &= e^{At}x(0) + e^{At}BK \\\\ &= e^{At}(x(0) + BK) \end{align*} $$


  • The effect of impulse inputs on the state response is similar to changing a set of initial conditions $x(0) \rightarrow x(0) + BK$


Step response


$$ u(t) = Ku_{\text{step}} = \begin{bmatrix} k_1 \\ k_2 \\ \vdots \\ k_p \end{bmatrix} u_{\text{step}}(t) $$


$$ \begin{align*} x(t) &= e^{At}x(0) + \int^t_0 e^{A(t-\tau)}Bu(\tau)d\tau \\ &= e^{At}x(0) + \int^t_0 e^{A(t-\tau)}BKd\tau \\ &= e^{At}x(0) + e^{At}\int^t_0 e^{-A\tau}d\tau BK \\ &= e^{At}x(0) + e^{At}[-A^{-1}e^{-A\tau} \big\rvert^t_0] BK \\ &= e^{At}x(0) + e^{At}[-A^{-1}e^{-At} + A^{-1}] BK \\ &= e^{At}x(0) + e^{At}A^{-1}[I - e^{-At}] BK \\ &= e^{At}x(0) + A^{-1}[e^{At} - I] BK \qquad (Ae^{At} = e^{At}A)\\\\ x(\infty) & = -A^{-1}BK \qquad \text{if the system is stable} \end{align*} $$
  • For spring, mass, and damper system




$$\ddot{y} + \frac{c}{m} \dot{y} + \frac{k}{m}y = g \, u_{\text{step}}(t)$$


$$ \begin{align*} \begin{bmatrix} \dot{x_1} \\ \dot{x_2} \end{bmatrix} &= \begin{bmatrix} 0 & 1 \\ -\frac{k}{m} & -\frac{c}{m} \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} + \begin{bmatrix} 0 \\ g \end{bmatrix}\cdot 1 \cdot u_{\text{step}}(t) \\\\ y &= \begin{bmatrix} 1 & 0 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} \end{align*} $$


$$ x(\infty) = -A^{-1}BK = -\begin{bmatrix}0 & 1\\-\frac{k}{m} & -\frac{c}{m}\end{bmatrix}^{-1} \begin{bmatrix} 0 \\ g \end{bmatrix}\cdot 1 \cdot = \begin{bmatrix} \frac{mg}{k} \\ 0\end{bmatrix} $$
In [2]:
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')