我使用巴特沃斯带通:
def butter_bandpass_prep(lowcut, highcut, fs, order=5):
"""Butterworth bandpass auxilliary function."""
nyq = 0.5 * fs # Minimal frequency (nyquist criterion)
low = lowcut / nyq
high = highcut / nyq
b, a = sp.signal.butter(order, [low, high], btype='band')
return b, a
def butter_bandpass(src, lowcut, highcut, fs, order=5):
"""Butterworth bandpass filter."""
b, a = butter_bandpass_prep(lowcut, highcut, fs, order=order)
dst = sp.signal.filtfilt(b, a, src)
return dst
我一般来说它似乎运作良好,但在边缘我总是得到一些不切实际的值。似乎过滤后的边际值下降到零......有没有办法防止这种情况发生?十分感谢!