Skip to content

Instantly share code, notes, and snippets.

@non117 non117/lpf.py
Created Jan 29, 2013

Embed
What would you like to do?
バターワースフィルタを設計して, LPFかけた信号を返してくれるえらいやつ
from scipy import signal
def lpf(x, cutoff_freq, samp_rate):
norm_pass = cutoff_freq/(samp_rate/2)
norm_stop = 1.5*norm_pass
N, Wn = signal.buttord(wp=norm_pass, ws=norm_stop, gpass=2, gstop=30, analog=0)
b, a = signal.butter(N, Wn, btype='low', analog=0, output='ba')
y = signal.lfilter(b, a, x)
return y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.