Initial
This commit is contained in:
23
IIR_filter.py
Normal file
23
IIR_filter.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import numpy as np
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import fft
|
||||
|
||||
class IIR_1_Order_LP(object):
|
||||
"""docstring for fft_meas"""
|
||||
def __init__(self, fs, fc=200):
|
||||
self.fs = fs
|
||||
self.fc = fc
|
||||
self.dt = 1/self.fs
|
||||
self.RC = 1 / (2*np.pi*self.fc)
|
||||
self.alpha = self.dt / (self.RC + self.dt)
|
||||
|
||||
self.y = 0
|
||||
|
||||
def step(self, x):
|
||||
self.y = self.y + self.alpha * (x - self.y)
|
||||
return self.y
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user