In [1]:
%matplotlib inline
from lcapy import *
from lcapy.discretetime import *


Warning, this is experimental and probably riddled with bugs!

In [11]:
h = 2 * ui(n) - ui(n-2)
h


Out[11]:
$$2 \delta\left[n\right] - \delta\left[n - 2\right]$$

In [3]:
h.plot();



In [4]:
H = h(z)
H


Out[4]:
$$2 - \frac{1}{z^{2}}$$

In [5]:
ax = H.plot();



In [6]:
H.DTFT()


Out[6]:
$$2 - e^{- 4 \mathrm{j} \pi \Delta_{t} f}$$

In [7]:
H.DTFT().subs(dt, 1).plot();



In [8]:
h.difference_equation()


Out[8]:
$$y(n) = 2 x(n) - x(n - 2)$$

In [9]:
h.difference_equation()(z)


Out[9]:
$$Y(z) = 2 X(z) - \frac{X(z)}{z^{2}}$$