State-Space Representation Continuous-Time: State Equation: $\dot{\mathbf{x}}(t) = \mathbf{A}\mathbf{x}(t) + \mathbf{B}\mathbf{u}(t)$ Output Equation: $\mathbf{y}(t) = \mathbf{C}\mathbf{x}(t) + \mathbf{D}\mathbf{u}(t)$ Where $\mathbf{x}$ is state vector, $\mathbf{u}$ is input vector, $\mathbf{y}$ is output vector. Discrete-Time: State Equation: $\mathbf{x}(k+1) = \mathbf{A}_d\mathbf{x}(k) + \mathbf{B}_d\mathbf{u}(k)$ Output Equation: $\mathbf{y}(k) = \mathbf{C}_d\mathbf{x}(k) + \mathbf{D}_d\mathbf{u}(k)$ Transfer Function from State-Space: $G(s) = \mathbf{C}(s\mathbf{I} - \mathbf{A})^{-1}\mathbf{B} + \mathbf{D}$ State Transition Matrix (STM): For continuous-time LTI systems: $\Phi(t) = e^{\mathbf{A}t} = \mathcal{L}^{-1}\{(s\mathbf{I} - \mathbf{A})^{-1}\}$ Solution to State Equation: $\mathbf{x}(t) = \Phi(t)\mathbf{x}(0) + \int_0^t \Phi(t-\tau)\mathbf{B}\mathbf{u}(\tau)d\tau$ For discrete-time LTI systems: $\Phi(k) = \mathbf{A}^k$ Solution: $\mathbf{x}(k) = \mathbf{A}^k\mathbf{x}(0) + \sum_{j=0}^{k-1} \mathbf{A}^{k-1-j}\mathbf{B}\mathbf{u}(j)$ Controllability and Observability Controllability Matrix (CTM): $\mathcal{C} = [\mathbf{B} \quad \mathbf{A}\mathbf{B} \quad \mathbf{A}^2\mathbf{B} \quad \dots \quad \mathbf{A}^{n-1}\mathbf{B}]$ System is controllable if $\text{rank}(\mathcal{C}) = n$ (full rank), where $n$ is the number of states. Observability Matrix (OTM): $\mathcal{O} = [\mathbf{C}^T \quad (\mathbf{C}\mathbf{A})^T \quad (\mathbf{C}\mathbf{A}^2)^T \quad \dots \quad (\mathbf{C}\mathbf{A}^{n-1})^T]^T$ System is observable if $\text{rank}(\mathcal{O}) = n$ (full rank). Shortcut (PBH Test - Eigenvalue Controllability/Observability): System is controllable if for all eigenvalues $\lambda_i$ of $\mathbf{A}$, $\text{rank}[s\mathbf{I}-\mathbf{A} \quad \mathbf{B}] = n$ for $s=\lambda_i$. System is observable if for all eigenvalues $\lambda_i$ of $\mathbf{A}$, $\text{rank}[s\mathbf{I}-\mathbf{A}^T \quad \mathbf{C}^T] = n$ for $s=\lambda_i$. State Feedback Control Full State Feedback: $\mathbf{u}(t) = -\mathbf{K}\mathbf{x}(t) + \mathbf{r}(t)$ Closed-loop system: $\dot{\mathbf{x}}(t) = (\mathbf{A} - \mathbf{B}\mathbf{K})\mathbf{x}(t) + \mathbf{B}\mathbf{r}(t)$ Desired characteristic equation: $\det(s\mathbf{I} - (\mathbf{A} - \mathbf{B}\mathbf{K})) = 0$ Pole Placement (Ackermann's Formula): If the system is controllable, we can place the closed-loop poles at desired locations. For SISO systems: $\mathbf{K} = [0 \quad 0 \quad \dots \quad 1] \mathcal{C}^{-1} \alpha_c(\mathbf{A})$ Where $\alpha_c(s) = s^n + \alpha_1 s^{n-1} + \dots + \alpha_n$ is the desired characteristic polynomial, and $\alpha_c(\mathbf{A}) = \mathbf{A}^n + \alpha_1 \mathbf{A}^{n-1} + \dots + \alpha_n \mathbf{I}$. State Observers Full-Order Observer: Observer dynamics: $\dot{\hat{\mathbf{x}}}(t) = \mathbf{A}\hat{\mathbf{x}}(t) + \mathbf{B}\mathbf{u}(t) + \mathbf{L}(\mathbf{y}(t) - \mathbf{C}\hat{\mathbf{x}}(t))$ Observer error dynamics: $\dot{\mathbf{e}}(t) = (\mathbf{A} - \mathbf{L}\mathbf{C})\mathbf{e}(t)$, where $\mathbf{e}(t) = \mathbf{x}(t) - \hat{\mathbf{x}}(t)$. Observer gain $\mathbf{L}$ is chosen to place observer poles (eigenvalues of $\mathbf{A} - \mathbf{L}\mathbf{C}$) at desired locations. The system must be observable for this. Dual relationship for $\mathbf{L}$: If $(\mathbf{A}, \mathbf{C})$ is observable, then $(\mathbf{A}^T, \mathbf{C}^T)$ is controllable. Use Ackermann's formula on the dual system to find $\mathbf{L}^T$. Separation Principle: The controller and observer can be designed independently. The poles of the overall system are the union of the controller poles and observer poles. Optimal Control (LQR) Linear Quadratic Regulator (LQR): Minimize the cost function: $J = \int_0^\infty (\mathbf{x}^T\mathbf{Q}\mathbf{x} + \mathbf{u}^T\mathbf{R}\mathbf{u}) dt$ Where $\mathbf{Q} \ge 0$ (positive semi-definite) and $\mathbf{R} > 0$ (positive definite). Optimal control law: $\mathbf{u}(t) = -\mathbf{K}\mathbf{x}(t)$ Feedback gain: $\mathbf{K} = \mathbf{R}^{-1}\mathbf{B}^T\mathbf{P}$ Where $\mathbf{P}$ is the unique positive definite solution to the Algebraic Riccati Equation (ARE): $\mathbf{A}^T\mathbf{P} + \mathbf{P}\mathbf{A} - \mathbf{P}\mathbf{B}\mathbf{R}^{-1}\mathbf{B}^T\mathbf{P} + \mathbf{Q} = \mathbf{0}$ Properties of LQR: Guarantees stability for controllable systems. Provides good robustness properties. Weights $\mathbf{Q}$ and $\mathbf{R}$ allow tuning of state deviation vs. control effort. Stability Analysis (Lyapunov) Lyapunov Stability Theorem (Continuous-Time): If there exists a scalar function $V(\mathbf{x})$ such that: $V(\mathbf{x}) > 0$ for $\mathbf{x} \ne \mathbf{0}$ and $V(\mathbf{0}) = 0$ (positive definite) $\dot{V}(\mathbf{x}) \le 0$ for all $\mathbf{x}$ (negative semi-definite) Then the equilibrium $\mathbf{x} = \mathbf{0}$ is stable. If $\dot{V}(\mathbf{x}) Lyapunov Equation for LTI Systems: Given $\dot{\mathbf{x}} = \mathbf{A}\mathbf{x}$, if $\mathbf{A}^T\mathbf{P} + \mathbf{P}\mathbf{A} = -\mathbf{Q}$ where $\mathbf{Q} > 0$, and $\mathbf{P} > 0$ is the solution, then the system is asymptotically stable. Candidate Lyapunov function: $V(\mathbf{x}) = \mathbf{x}^T\mathbf{P}\mathbf{x}$. Discrete-Time Systems Discretization of Continuous-Time: If $\dot{\mathbf{x}}(t) = \mathbf{A}\mathbf{x}(t) + \mathbf{B}\mathbf{u}(t)$ with ZOH, then $\mathbf{A}_d = e^{\mathbf{A}T}$ $\mathbf{B}_d = (\int_0^T e^{\mathbf{A}\tau} d\tau) \mathbf{B} = \mathbf{A}^{-1}(e^{\mathbf{A}T} - \mathbf{I})\mathbf{B}$ (if $\mathbf{A}$ is invertible) Stability for Discrete-Time: Asymptotically stable if all eigenvalues of $\mathbf{A}_d$ are inside the unit circle ($|\lambda_i| Lyapunov Stability Theorem (Discrete-Time): If there exists $V(\mathbf{x}(k))$ such that $V(\mathbf{x}(k)) > 0$ for $\mathbf{x}(k) \ne \mathbf{0}$ and $\Delta V(\mathbf{x}(k)) = V(\mathbf{x}(k+1)) - V(\mathbf{x}(k)) Discrete Lyapunov Equation: $\mathbf{A}_d^T\mathbf{P}\mathbf{A}_d - \mathbf{P} = -\mathbf{Q}$ where $\mathbf{Q} > 0$. If $\mathbf{P} > 0$ is the solution, system is asymptotically stable. Important Tricks and Notes Similarity Transformation: $\hat{\mathbf{A}} = \mathbf{T}^{-1}\mathbf{A}\mathbf{T}$, $\hat{\mathbf{B}} = \mathbf{T}^{-1}\mathbf{B}$, $\hat{\mathbf{C}} = \mathbf{C}\mathbf{T}$, $\hat{\mathbf{D}} = \mathbf{D}$. Eigenvalues, transfer function, controllability, and observability are invariant under similarity transformation (if $\mathbf{T}$ is invertible). Canonical Forms: Controllable Canonical Form (CCF): Useful for pole placement. $\mathbf{A}_c = \begin{pmatrix} 0 & 1 & \dots & 0 \\ \vdots & \ddots & \ddots & \vdots \\ 0 & \dots & 0 & 1 \\ -\alpha_n & -\alpha_{n-1} & \dots & -\alpha_1 \end{pmatrix}$, $\mathbf{B}_c = \begin{pmatrix} 0 \\ \vdots \\ 0 \\ 1 \end{pmatrix}$ Characteristic equation: $s^n + \alpha_1 s^{n-1} + \dots + \alpha_n = 0$. Observable Canonical Form (OCF): Useful for observer design. $\mathbf{A}_o = \begin{pmatrix} 0 & \dots & 0 & -\alpha_n \\ 1 & \dots & 0 & -\alpha_{n-1} \\ \vdots & \ddots & \vdots & \vdots \\ 0 & \dots & 1 & -\alpha_1 \end{pmatrix}$, $\mathbf{C}_o = \begin{pmatrix} 0 & \dots & 0 & 1 \end{pmatrix}$ Relationship between CCF and OCF: $(\mathbf{A}_o, \mathbf{B}_o, \mathbf{C}_o, \mathbf{D}_o)$ is the dual of $(\mathbf{A}_c, \mathbf{C}_c^T, \mathbf{B}_c^T, \mathbf{D}_c)$. I.e., $\mathbf{A}_o = \mathbf{A}_c^T$, $\mathbf{C}_o = \mathbf{B}_c^T$. Cayley-Hamilton Theorem: A matrix satisfies its own characteristic equation. Use this to calculate $\mathbf{A}^k$ or $e^{\mathbf{A}t}$ without direct matrix exponentiation for small $n$. If $P(\lambda) = \det(\lambda\mathbf{I} - \mathbf{A}) = \lambda^n + a_{n-1}\lambda^{n-1} + \dots + a_0$, then $P(\mathbf{A}) = \mathbf{A}^n + a_{n-1}\mathbf{A}^{n-1} + \dots + a_0\mathbf{I} = \mathbf{0}$. This allows expressing higher powers of $\mathbf{A}$ as linear combinations of lower powers. Modal Decomposition: If $\mathbf{A}$ is diagonalizable, $\mathbf{A} = \mathbf{P}\Lambda\mathbf{P}^{-1}$, where $\Lambda$ is a diagonal matrix of eigenvalues and $\mathbf{P}$ is the matrix of eigenvectors. $e^{\mathbf{A}t} = \mathbf{P}e^{\Lambda t}\mathbf{P}^{-1} = \mathbf{P} \begin{pmatrix} e^{\lambda_1 t} & & \\ & \ddots & \\ & & e^{\lambda_n t} \end{pmatrix} \mathbf{P}^{-1}$ This simplifies calculating the state transition matrix.