更新时间:2022-03-13 16:29:02
以下用于计算[fmin,fmax]频段功率的代码段对我有用:
The following snippet for computing the power in the band [fmin, fmax] worked for me:
import scipy
def bandpower(x, fs, fmin, fmax):
f, Pxx = scipy.signal.periodogram(x, fs=fs)
ind_min = scipy.argmax(f > fmin) - 1
ind_max = scipy.argmax(f > fmax) - 1
return scipy.trapz(Pxx[ind_min: ind_max], f[ind_min: ind_max])