24 lines
389 B
Python
24 lines
389 B
Python
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
|
|
|
|
|
|
|
|
|