# 状态空间

（重定向自狀態空間

## 線性系統

${\displaystyle {\dot {\mathbf {x} }}(t)=A(t)\mathbf {x} (t)+B(t)\mathbf {u} (t)}$
${\displaystyle \mathbf {y} (t)=C(t)\mathbf {x} (t)+D(t)\mathbf {u} (t)}$

${\displaystyle \mathbf {x} (\cdot )}$ 稱為狀態向量，  ${\displaystyle \mathbf {x} (t)\in \mathbb {R} ^{n}}$ ;
${\displaystyle \mathbf {y} (\cdot )}$ 稱為輸出向量，  ${\displaystyle \mathbf {y} (t)\in \mathbb {R} ^{q}}$ ;
${\displaystyle \mathbf {u} (\cdot )}$ 稱為輸入向量（或控制向量），  ${\displaystyle \mathbf {u} (t)\in \mathbb {R} ^{p}}$ ;
${\displaystyle A(\cdot )}$ 稱為狀態矩陣，  ${\displaystyle \operatorname {dim} [A(\cdot )]=n\times n}$ ,
${\displaystyle B(\cdot )}$ 稱為輸入矩陣，  ${\displaystyle \operatorname {dim} [B(\cdot )]=n\times p}$ ,
${\displaystyle C(\cdot )}$ 稱為輸出矩陣，  ${\displaystyle \operatorname {dim} [C(\cdot )]=q\times n}$ ,
${\displaystyle D(\cdot )}$ 稱為前饋矩陣（若系統沒有直接從輸入到輸出的路徑，此矩陣為零矩陣），  ${\displaystyle \operatorname {dim} [D(\cdot )]=q\times p}$ ,
${\displaystyle {\dot {\mathbf {x} }}(t):={\frac {\operatorname {d} }{\operatorname {d} t}}\mathbf {x} (t)}$ .

 系統形式 状态空间模型 連續非時變系統 ${\displaystyle {\dot {\mathbf {x} }}(t)=A\mathbf {x} (t)+B\mathbf {u} (t)}$ ${\displaystyle \mathbf {y} (t)=C\mathbf {x} (t)+D\mathbf {u} (t)}$ 連續時變系統 ${\displaystyle {\dot {\mathbf {x} }}(t)=\mathbf {A} (t)\mathbf {x} (t)+\mathbf {B} (t)\mathbf {u} (t)}$ ${\displaystyle \mathbf {y} (t)=\mathbf {C} (t)\mathbf {x} (t)+\mathbf {D} (t)\mathbf {u} (t)}$ 離散非時變系統 ${\displaystyle \mathbf {x} (k+1)=A\mathbf {x} (k)+B\mathbf {u} (k)}$ ${\displaystyle \mathbf {y} (k)=C\mathbf {x} (k)+D\mathbf {u} (k)}$ 離散時變系統 ${\displaystyle \mathbf {x} (k+1)=\mathbf {A} (k)\mathbf {x} (k)+\mathbf {B} (k)\mathbf {u} (k)}$ ${\displaystyle \mathbf {y} (k)=\mathbf {C} (k)\mathbf {x} (k)+\mathbf {D} (k)\mathbf {u} (k)}$ 連續非時變系統轉換到s域 ${\displaystyle s\mathbf {X} (s)=A\mathbf {X} (s)+B\mathbf {U} (s)}$ ${\displaystyle \mathbf {Y} (s)=C\mathbf {X} (s)+D\mathbf {U} (s)}$ 離散非時變系統轉換到Z-域 ${\displaystyle z\mathbf {X} (z)=A\mathbf {X} (z)+B\mathbf {U} (z)}$ ${\displaystyle \mathbf {Y} (z)=C\mathbf {X} (z)+D\mathbf {U} (z)}$

### 連續非時變系統的例子

${\displaystyle {\textbf {G}}(s)=k{\frac {(s-z_{1})(s-z_{2})(s-z_{3})}{(s-p_{1})(s-p_{2})(s-p_{3})(s-p_{4})}}}$

${\displaystyle \mathbf {\lambda } (s)=|sI-A|}$ .

### 傳遞函數

${\displaystyle {\dot {\mathbf {x} }}(t)=A\mathbf {x} (t)+B\mathbf {u} (t)}$

${\displaystyle s\mathbf {X} (s)=A\mathbf {X} (s)+B\mathbf {U} (s)}$

${\displaystyle (s\mathbf {I} -A)\mathbf {X} (s)=B\mathbf {U} (s)}$
${\displaystyle \mathbf {X} (s)=(s\mathbf {I} -A)^{-1}B\mathbf {U} (s)}$

${\displaystyle \mathbf {Y} (s)=C\mathbf {X} (s)+D\mathbf {U} (s)}$

${\displaystyle \mathbf {Y} (s)=C((s\mathbf {I} -A)^{-1}B\mathbf {U} (s))+D\mathbf {U} (s)}$

${\displaystyle \mathbf {G} (s)=\mathbf {Y} (s)/\mathbf {U} (s)}$

${\displaystyle \mathbf {G} (s)=C(s\mathbf {I} -A)^{-1}B+D}$

${\displaystyle \mathbf {G} (s)}$ 必须是${\displaystyle q\times p}$ 的矩陣。

### 可控制性

${\displaystyle \operatorname {rank} {\begin{bmatrix}B&AB&A^{2}B&...&A^{n-1}B\end{bmatrix}}=n}$

### 可觀察性

${\displaystyle \operatorname {rank} {\begin{bmatrix}C\\CA\\...\\CA^{n-1}\end{bmatrix}}=n}$

### 传递函数

${\displaystyle {\dot {\mathbf {x} }}(t)=A\mathbf {x} (t)+B\mathbf {u} (t)}$

${\displaystyle s\mathbf {X} (s)-\mathbf {x} (0)=A\mathbf {X} (s)+B\mathbf {U} (s).}$

${\displaystyle (s\mathbf {I} -A)\mathbf {X} (s)=\mathbf {x} (0)+B\mathbf {U} (s),}$

${\displaystyle \mathbf {X} (s)=(s\mathbf {I} -A)^{-1}\mathbf {x} (0)+(s\mathbf {I} -A)^{-1}B\mathbf {U} (s).}$

${\displaystyle \mathbf {Y} (s)=C\mathbf {X} (s)+D\mathbf {U} (s),}$ 可得
${\displaystyle \mathbf {Y} (s)=C((s\mathbf {I} -A)^{-1}\mathbf {x} (0)+(s\mathbf {I} -A)^{-1}B\mathbf {U} (s))+D\mathbf {U} (s).}$

${\displaystyle \mathbf {G} (s)\times \mathbf {U} (s)=\mathbf {Y} (s)}$

${\displaystyle \mathbf {G} (s)=C(s\mathbf {I} -A)^{-1}B+D.}$

### 正則实现

${\displaystyle {\textbf {G}}(s)={\frac {n_{1}s^{3}+n_{2}s^{2}+n_{3}s+n_{4}}{s^{4}+d_{1}s^{3}+d_{2}s^{2}+d_{3}s+d_{4}}}}$ .

${\displaystyle {\dot {\textbf {x}}}(t)={\begin{bmatrix}-d_{1}&-d_{2}&-d_{3}&-d_{4}\\1&0&0&0\\0&1&0&0\\0&0&1&0\end{bmatrix}}{\textbf {x}}(t)+{\begin{bmatrix}1\\0\\0\\0\\\end{bmatrix}}{\textbf {u}}(t)}$
${\displaystyle {\textbf {y}}(t)={\begin{bmatrix}n_{1}&n_{2}&n_{3}&n_{4}\end{bmatrix}}{\textbf {x}}(t)}$ .

${\displaystyle {\dot {\textbf {x}}}(t)={\begin{bmatrix}-d_{1}&1&0&0\\-d_{2}&0&1&0\\-d_{3}&0&0&1\\-d_{4}&0&0&0\end{bmatrix}}{\textbf {x}}(t)+{\begin{bmatrix}n_{1}\\n_{2}\\n_{3}\\n_{4}\end{bmatrix}}{\textbf {u}}(t)}$
${\displaystyle {\textbf {y}}(t)={\begin{bmatrix}1&0&0&0\end{bmatrix}}{\textbf {x}}(t)}$ .

### 真分傳遞函數

${\displaystyle {\textbf {G}}(s)={\textbf {G}}_{SP}(s)+{\textbf {G}}(\infty )}$

${\displaystyle {\textbf {G}}(s)={\frac {s^{2}+3s+3}{s^{2}+2s+1}}={\frac {s+2}{s^{2}+2s+1}}+1}$

${\displaystyle {\dot {\textbf {x}}}(t)={\begin{bmatrix}-2&-1\\1&0\\\end{bmatrix}}{\textbf {x}}(t)+{\begin{bmatrix}1\\0\end{bmatrix}}{\textbf {u}}(t)}$
${\displaystyle {\textbf {y}}(t)={\begin{bmatrix}1&2\end{bmatrix}}{\textbf {x}}(t)+{\begin{bmatrix}1\end{bmatrix}}{\textbf {u}}(t)}$

### 反饋

${\displaystyle {\dot {\mathbf {x} }}(t)=A\mathbf {x} (t)+B\mathbf {u} (t)}$
${\displaystyle \mathbf {y} (t)=C\mathbf {x} (t)+D\mathbf {u} (t)}$

${\displaystyle {\dot {\mathbf {x} }}(t)=A\mathbf {x} (t)+BK\mathbf {y} (t)}$
${\displaystyle \mathbf {y} (t)=C\mathbf {x} (t)+DK\mathbf {y} (t)}$

${\displaystyle {\dot {\mathbf {x} }}(t)=\left(A+BK\left(I-DK\right)^{-1}C\right)\mathbf {x} (t)}$
${\displaystyle \mathbf {y} (t)=\left(I-DK\right)^{-1}C\mathbf {x} (t)}$

${\displaystyle {\dot {\mathbf {x} }}(t)=\left(A+BK\right)\mathbf {x} (t)}$
${\displaystyle \mathbf {y} (t)=\mathbf {x} (t)}$

### 有回授及目標值輸入

${\displaystyle {\dot {\mathbf {x} }}(t)=A\mathbf {x} (t)+B\mathbf {u} (t)}$
${\displaystyle \mathbf {y} (t)=C\mathbf {x} (t)+D\mathbf {u} (t)}$

${\displaystyle {\dot {\mathbf {x} }}(t)=A\mathbf {x} (t)-BK\mathbf {y} (t)+B\mathbf {r} (t)}$
${\displaystyle \mathbf {y} (t)=C\mathbf {x} (t)-DK\mathbf {y} (t)+D\mathbf {r} (t)}$

${\displaystyle {\dot {\mathbf {x} }}(t)=\left(A-BK\left(I+DK\right)^{-1}C\right)\mathbf {x} (t)+B\left(I-K\left(I+DK\right)^{-1}D\right)\mathbf {r} (t)}$
${\displaystyle \mathbf {y} (t)=\left(I+DK\right)^{-1}C\mathbf {x} (t)+\left(I+DK\right)^{-1}D\mathbf {r} (t)}$

${\displaystyle {\dot {\mathbf {x} }}(t)=\left(A-BKC\right)\mathbf {x} (t)+B\mathbf {r} (t)}$
${\displaystyle \mathbf {y} (t)=C\mathbf {x} (t)}$

### 移動物體的範例

${\displaystyle m{\ddot {y}}(t)=u(t)-k_{1}{\dot {y}}(t)-k_{2}y(t)}$

• ${\displaystyle y(t)}$ 為位置，${\displaystyle {\dot {y}}(t)}$ ${\displaystyle {\ddot {y}}(t)}$ 分別是速度及加速度
• ${\displaystyle u(t)}$ 為施力
• ${\displaystyle k_{1}}$ 為粘滞摩擦係數
• ${\displaystyle k_{2}}$ 為彈簧的彈性常數
• ${\displaystyle m}$ 為物體的質量

${\displaystyle \left[{\begin{matrix}\mathbf {\dot {x_{1}}} (t)\\\mathbf {\dot {x_{2}}} (t)\end{matrix}}\right]=\left[{\begin{matrix}0&1\\-{\frac {k_{2}}{m}}&-{\frac {k_{1}}{m}}\end{matrix}}\right]\left[{\begin{matrix}\mathbf {x_{1}} (t)\\\mathbf {x_{2}} (t)\end{matrix}}\right]+\left[{\begin{matrix}0\\{\frac {1}{m}}\end{matrix}}\right]\mathbf {u} (t)}$
${\displaystyle \mathbf {y} (t)=\left[{\begin{matrix}1&0\end{matrix}}\right]\left[{\begin{matrix}\mathbf {x_{1}} (t)\\\mathbf {x_{2}} (t)\end{matrix}}\right]}$

• ${\displaystyle x_{1}(t)}$ 為物體的位置
• ${\displaystyle x_{2}(t)={\dot {x_{1}}}(t)}$ 為物體的速度
• ${\displaystyle {\dot {x_{2}}}(t)={\ddot {x_{1}}}(t)}$ 為物體的加速度
• 輸出${\displaystyle \mathbf {y} (t)}$ 為物體的位置

${\displaystyle \left[{\begin{matrix}B&AB\end{matrix}}\right]=\left[{\begin{matrix}\left[{\begin{matrix}0\\{\frac {1}{m}}\end{matrix}}\right]&\left[{\begin{matrix}0&1\\-{\frac {k_{2}}{m}}&-{\frac {k_{1}}{m}}\end{matrix}}\right]\left[{\begin{matrix}0\\{\frac {1}{m}}\end{matrix}}\right]\end{matrix}}\right]=\left[{\begin{matrix}0&{\frac {1}{m}}\\{\frac {1}{m}}&{\frac {k_{1}}{m^{2}}}\end{matrix}}\right]}$

${\displaystyle \left[{\begin{matrix}C\\CA\end{matrix}}\right]=\left[{\begin{matrix}\left[{\begin{matrix}1&0\end{matrix}}\right]\\\left[{\begin{matrix}1&0\end{matrix}}\right]\left[{\begin{matrix}0&1\\-{\frac {k_{2}}{m}}&-{\frac {k_{1}}{m}}\end{matrix}}\right]\end{matrix}}\right]=\left[{\begin{matrix}1&0\\0&1\end{matrix}}\right]}$

## 非線性系統

${\displaystyle \mathbf {\dot {x}} (t)=\mathbf {f} (t,x(t),u(t))}$
${\displaystyle \mathbf {y} (t)=\mathbf {h} (t,x(t),u(t))}$

### 單擺的範例

${\displaystyle ml{\ddot {\theta }}(t)=-mg\sin \theta (t)-kl{\dot {\theta }}(t)}$

• ${\displaystyle \theta (t)}$ 為單擺偏離垂線的角度
• ${\displaystyle m}$ 為單擺的質量（單擺的線或桿的質量假設為零）
• ${\displaystyle g}$ 為重力加速度
• ${\displaystyle k}$ 為摩擦係數
• ${\displaystyle l}$ 為單擺的半徑（以質量${\displaystyle m}$ 的重心位置為準）

${\displaystyle {\dot {x_{1}}}(t)=x_{2}(t)}$
${\displaystyle {\dot {x_{2}}}(t)=-{\frac {g}{l}}\sin {x_{1}}(t)-{\frac {k}{m}}{x_{2}}(t)}$

• ${\displaystyle x_{1}(t)=\theta (t)}$ 為單擺的角度
• ${\displaystyle x_{2}(t)={\dot {x_{1}}}(t)}$ 為單擺的角速度
• ${\displaystyle {\dot {x_{2}}}={\ddot {x_{1}}}}$ 為單擺的角加速度

${\displaystyle {\dot {x}}(t)=\left({\begin{matrix}{\dot {x_{1}}}(t)\\{\dot {x_{2}}}(t)\end{matrix}}\right)=\mathbf {f} (t,x(t))=\left({\begin{matrix}x_{2}(t)\\-{\frac {g}{l}}\sin {x_{1}}(t)-{\frac {k}{m}}{x_{2}}(t)\end{matrix}}\right).}$

${\displaystyle \left({\begin{matrix}x_{1}\\x_{2}\end{matrix}}\right)=\left({\begin{matrix}n\pi \\0\end{matrix}}\right)}$

## 参考来源

1. ^ I.J.Nagrath, M.Goral. Control System Engineering. Wiley Eastern Limited. 1985: 450. ISBN 9579590532.
2. ^ 朱福喜,朱三元,伍春香. 《人工智能基础教程》. 清华大学出版社. 2006年. ISBN 9787302125778.