Complementary Filter

Convert continuous transfer function into discrete

In [8]:
import scipy.signal as sig
from math import sqrt

dt = 0.01
ki = 0.1**2
kp = sqrt(2)*0.1

num = [kp, ki]
den = [1, 0.]
sig.cont2discrete(sys=(num,den), dt=0.1)
Out[8]:
(array([[ 0.14142136, -0.14042136]]), array([ 1., -1.]), 0.1)
In [11]:
a = 5
num = [a, 0]
den = [a, 1]
sig.cont2discrete(sys=(num,den), dt=0.1)
Out[11]:
(array([[ 1., -1.]]), array([ 1.        , -0.98019867]), 0.1)
In [39]:
from sympy import *
from sympy.abc import *
a = Symbol('a', positive=True)
foo = (s/(s+a)).rewrite()
print(foo)
inverse_laplace_transform(1/((s+a)), s, t)
s/(a + s)
Out[39]:
exp(-a*t)*Heaviside(t)
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]: