# Discretization of linear state-space model

In practice, the discretization of the state-space equations is of particular importance.

For systems with high degrees of freedom (>2), the determination is not particularly trivial and presents even experienced individuals with considerable challenges due to the specialized algebra.

The details of the derivation shall be omitted here because this is only suitable for the really interested reader and here we will deal with the very practical determination with the help of MATLAB.

In general, it is recommended to simplify the matrices in continuous time as much as possible before performing the discretization.

### Formulas based on ZOH discretization

\[ \mathbf{A}_d = e^{\mathbf{A} T_s} \]

\[ \mathbf{B}_d = \int^{T_s}_{0} e^{\mathbf{A} \tau} d \tau \mathbf{B} \]

\[ \mathbf{G}_d = \int^{T_s}_{0} e^{\mathbf{A} \tau} \mathbf{G} d \tau \]

\[ \mathbf{Q}_d = \int^{T_s}_{0} e^{\mathbf{A} \tau} \mathbf{Q} e^{\mathbf{A}^T \tau} d \tau \]

\[ \mathbf{R}_d = \mathbf{R} \frac{1}{T_s} \]

### Computation in MATLAB

### An elegant way

A particularly elegant way is to construct a matrix that yields the same result as described above.

\[ e^{\begin{bmatrix}\mathbf{A} & \mathbf{B}\\ \mathbf{0} & \mathbf{0}\end{bmatrix} \cdot T_s} = \begin{bmatrix}\mathbf{A}_d & \mathbf{B}_d \\ \mathbf{0} & \mathbf{I}\end{bmatrix} \]

For exampel for a system with \( \mathbf{A}_{3 \times 3}, \mathbf{B}_{1 \times 3} \)