```python
%load_ext autoreload
%autoreload 2  # automatically reload modules when changed
import simba
from sympy import symbols, simplify, init_printing, Matrix, MatrixSymbol, Rational, adjoint, Symbol
init_printing()
```

The unstable filter transfer function is given by,

$$
G(s) = \frac{s - 2}{s + 2}
$$


```python
s = symbols('s')
tf = (s - 2) / (s + 2)
tf
```


```python
ss = simba.transfer_function_to_state_space(tf).extended_to_quantum()
a, b, c, d = ss
ss
```




$$\displaystyle A=\left[\begin{matrix}2 & 0\\0 & 2\end{matrix}\right],\,B=\left[\begin{matrix}1 & 0\\0 & 1\end{matrix}\right],\,C=\left[\begin{matrix}4 & 0\\0 & 4\end{matrix}\right],\,D=\left[\begin{matrix}1 & 0\\0 & 1\end{matrix}\right]$$



Convert to a physically realisable state space


```python
ss = ss.to_physically_realisable()
assert ss.is_physically_realisable
ss
```




$$\displaystyle A=\left[\begin{matrix}2 & 0\\0 & 2\end{matrix}\right],\,B=\left[\begin{matrix}0 & 2\\2 & 0\end{matrix}\right],\,C=\left[\begin{matrix}0 & 2\\2 & 0\end{matrix}\right],\,D=\left[\begin{matrix}1 & 0\\0 & 1\end{matrix}\right]$$




```python
slh = ss.to_slh('a')
slh
```




$$\displaystyle \left(I_{2\times2}, \left[\begin{matrix}0 & 2\\2 & 0\end{matrix}\right] \left[\begin{matrix}a_{1}\\\overline{a_{1}}\end{matrix}\right], \frac{1}{2} \left[\begin{matrix}\overline{a_{1}} & a_{1}\end{matrix}\right] \left[\begin{matrix}0 & 0\\0 & 0\end{matrix}\right] \left[\begin{matrix}a_{1}\\\overline{a_{1}}\end{matrix}\right]\right)$$



ab6ff0b8b1609f5ce0e6edb8029c03e80f77b3d4
ipynb
Jupyter Notebook
notebooks/unstable_filter.ipynb
joebentley/simba
dd1b7bc6d22ad96566898dd1851cfa210462cb00
MIT
2020-03-19T10:59:25.000Z
2022-01-22T22:33:07.000Z
notebooks/unstable_filter.ipynb
joebentley/simba
dd1b7bc6d22ad96566898dd1851cfa210462cb00
MIT
2022-01-22T11:24:45.000Z
2022-01-22T11:24:45.000Z
notebooks/unstable_filter.ipynb
joebentley/simba
dd1b7bc6d22ad96566898dd1851cfa210462cb00
MIT
2020-03-19T13:27:41.000Z
2020-03-19T13:27:41.000Z
Qwen/Qwen-72B
1. YES
2. YES