```python
import sympy
```

$$u(t) = \mathcal{1}(t)$$

$$g(t) = e^{-t}\mathcal{1}(t)$$

$$y(t) = u(t) \bigotimes g(t) = \mathcal{L}^{-1}(U(s) G(s)) = \mathcal{L}^{-1}\left(\frac{1}{s} \cdot \frac{1}{s+1}\right)
= \mathcal{L}^{-1}\left(\frac{1}{s(s+1)}\right)= \mathcal{L}^{-1}\left(\frac{1}{s} - \frac{1}{s+1}\right) =
\mathcal{1}(t) - e^{-t}\mathcal{1}(t)$$


```python
t = sympy.symbols('t', real=True)
u = sympy.Heaviside(t)  # unit step
g = sympy.exp(-t)*sympy.Heaviside(t)
y = sympy.Heaviside(t) - sympy.exp(-t)*sympy.Heaviside(t)
g
```




$\displaystyle e^{- t} \theta\left(t\right)$




```python
sympy.plot(y)
```


```python
sympy.plot(g)
```


```python
y_approx = g + g.subs(t, t - 1) + g.subs(t, t - 2) + g.subs(t, t - 3) + g.subs(t, t - 4)
y_approx
```




$\displaystyle e^{1 - t} \theta\left(t - 1\right) + e^{2 - t} \theta\left(t - 2\right) + e^{3 - t} \theta\left(t - 3\right) + e^{4 - t} \theta\left(t - 4\right) + e^{- t} \theta\left(t\right)$




```python
sympy.plot(y_approx, y, (t, 0, 4))
```


```python
y_approx2 = 0.5*g + 0.5*g.subs(t, t - 0.5) + 0.5*g.subs(t, t - 1) + 0.5*g.subs(t, t - 1.5) + 0.5*g.subs(t, t - 2) \
    + 0.5*g.subs(t, t - 2.5) + 0.5*g.subs(t, t - 3) + 0.5*g.subs(t, t - 3.5) + 0.5*g.subs(t, t - 4)
y_approx2
```




$\displaystyle 0.5 e^{1 - t} \theta\left(t - 1\right) + 0.5 e^{2 - t} \theta\left(t - 2\right) + 0.5 e^{3 - t} \theta\left(t - 3\right) + 0.5 e^{4 - t} \theta\left(t - 4\right) + 0.5 e^{- t} \theta\left(t\right) + 16.5577259793462 e^{- t} \theta\left(t - 3.5\right) + 6.09124698035174 e^{- t} \theta\left(t - 2.5\right) + 2.24084453516903 e^{- t} \theta\left(t - 1.5\right) + 0.824360635350064 e^{- t} \theta\left(t - 0.5\right)$




```python
y_approx3 = 0
tf = 4
dt = 0.1
for i in range(int(tf/dt)):
    y_approx3 += dt*g.subs(t, t-i*dt)
```


```python
y4 = sympy.Heaviside(t) - sympy.exp(-t) + t*sympy.exp(t)
sympy.plot(y4, (t, -3, 3))
```


```python
y4 = (1 - sympy.exp(-t) + t*sympy.exp(t))*sympy.Heaviside(t)
sympy.plot(y4, (t, -3, 3))
```


```python
sympy.plot(y, y_approx3, (t, 0, 4))
```


```python
sympy.plot(y_approx, y, y_approx2, (t, 0, 4))
```


```python

```

832b086331b6aad96fe72e37273ae4943ef03b6e
ipynb
Jupyter Notebook
02.Convolution-Example.ipynb
jgoppert/aae364_notebook
bc77866860e6bdb7d59467ce9817a604c7f26e20
BSD-3-Clause
2020-01-18T03:46:08.000Z
2020-01-18T03:46:08.000Z
02.Convolution-Example.ipynb
jgoppert/aae364_notebook
bc77866860e6bdb7d59467ce9817a604c7f26e20
BSD-3-Clause
02.Convolution-Example.ipynb
jgoppert/aae364_notebook
bc77866860e6bdb7d59467ce9817a604c7f26e20
BSD-3-Clause
2019-03-30T19:32:13.000Z
2020-07-09T07:18:17.000Z
Qwen/Qwen-72B
1. YES
2. YES