```python
import numpy as np
import sympy as sy
import control.matlab as cm
sy.init_printing()
```

# Zero order hold sampling of a first order system

\begin{equation}
G(s) = \frac{1}{s-\lambda}
\end{equation}




```python
h, lam = sy.symbols('h, lambda', real=True, positive=True)
s, z = sy.symbols('s, z', real=False)
```


```python
G = 1/(s-lam)
Y = G/s
Yp = sy.apart(Y, s)
Yp
```


```python
from sympy.integrals.transforms import inverse_laplace_transform
from sympy.abc import t
```


```python
inverse_laplace_transform(Yp, s, t)
```

## Sampling and taking the z-transform of the step-response
\begin{equation}
Y(z) = \frac{1}{\lambda} \left( \frac{z}{z-\mathrm{e}^{\lambda h}} - \frac{z}{z-1} \right).
\end{equation}

## Dividing by the z-transform of the input signal 
\begin{equation}
H(z) = \frac{z-1}{z}Y(z) = \frac{1}{\lambda} \left( \frac{ \mathrm{e}^{\lambda h} - 1 }{ z - \mathrm{e}^{\lambda h} } \right)
\end{equation}


## Verifying for specific value of lambda


```python
lam = -0.5
h = 0.1
G = cm.tf([1], [1, -lam])
Gd = cm.c2d(G, h)
Hd = 1/lam * cm.tf([np.exp(lam*h)-1],[1, np.exp(lam*h)])
```


```python
print(Gd)
print(Hd)
```

    
      0.09754
    ----------
    z - 0.9512
    
    dt = 0.1
    
    
      0.09754
    ----------
    s + 0.9512
    



```python

```

65b511ec11d9b571cd2d6ec5ffb3628758b5d9c7
ipynb
Jupyter Notebook
discrete-time-systems/notebooks/Zero-order-hold sampling.ipynb
kjartan-at-tec/mr2007-computerized-control
16e35f5007f53870eaf344eea1165507505ab4aa
MIT
2020-11-07T05:20:37.000Z
2020-12-22T09:46:13.000Z
discrete-time-systems/notebooks/Zero-order-hold sampling.ipynb
alfkjartan/control-computarizado
5b9a3ae67602d131adf0b306f3ffce7a4914bf8e
MIT
2020-06-12T20:44:41.000Z
2020-06-12T20:49:00.000Z
discrete-time-systems/notebooks/Zero-order-hold sampling.ipynb
alfkjartan/control-computarizado
5b9a3ae67602d131adf0b306f3ffce7a4914bf8e
MIT
2019-09-25T20:02:23.000Z
2019-09-25T20:02:23.000Z
Qwen/Qwen-72B
1. YES
2. YES