0

它昨天工作,但现在它拒绝工作。没有对代码进行任何更改。怎么了?

# Obtain filter coefficients here.
lowcut = 4400
highcut = 39700
order = 2
nyq = 0.5 * sampling_freq
def butter_bandstop_filter(data, lowcut, highcut, sampling_freq, order):
    low = lowcut / nyq
    high = highcut / nyq
    b, a = scipy.signal.butter(order, [low, high], btype='bandstop', analog=True, output='ba')
    y = lfilter(b, a, data)
    return y
signal_filtered = butter_bandstop_filter(sig, lowcut, highcut, sampling_freq, order)
# Use the filter here.
filtered = signal.filtfilt(b, a, sig)

NameError: name 'b' is not defined

4

0 回答 0