Dynamic Systems:
State Space
Table of Contents
$$
\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)
$$
$$
\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
$$
$$
{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}
$$
$$\dot{x} = Ax + Bu$$
$$
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 \\
$$
$$
\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}
$$
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
What is the solution to this system?
For higher-order systems, we just get a matrix version of this
The matrix exponential plays such an important role that it has its own name: the state transition matrix, $\Phi(t)$
$$
\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*}
$$
% 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')
But what if we have the controlled system: $\dot{x} = Ax + Bu$
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$$
Impulse response
Step response
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')