1

我的巴特沃斯带通滤波器有问题。我有一个以 250Hz 记录的一维阵列(eeg 信号)。截止频率为 6 和 11 Hz。我现在拥有的是这个,它不起作用:

import numpy as np
import matplotlib.pyplot as plt
from pylab import *
import scipy.io
import scipy.signal
import scipy.fftpack
from scipy.signal import butter, lfilter
def butter_bandpass(lowcut, highcut, fs, order=6):
    nyq = 0.5 * fs
    low = lowcut / nyq
    high = highcut / nyq
    b, a = butter(order, [low, high], btype='band')
    return b, a


def butter_bandpass_filter(data, lowcut, highcut, fs, order=6):
    b, a = butter_bandpass(lowcut, highcut, fs, order=order)
    y = lfilter(b, a, data)
    return y


if __name__ == "__main__":
    fs = 250.0
    lowcut = 6.0
    highcut = 11.0
    t = range(len(eeg))
    x = eeg[t]
    y = butter_bandpass_filter(x, lowcut, highcut, fs, order=6)
    plt.plot(t, y)
    plt.show() 

怎么了?

谢谢迈克

4

0 回答 0