import numpy as np
# 均方根
def featureRMS(data):
return np.sqrt(np.mean(data ** 2, axis=0))
# 取绝对值求各列均值
def featureMAV(data):
return np.mean(np.abs(data), axis=0)
# 求离散的差值,按列的后尾元素向上面的元素进行求差,然后取绝对值再求所有矩阵同一元素位置的和,最后除以矩阵个数
def featureWL(data):
return np.sum(np.abs(np.diff(data, axis=0)), axis=0) / data.shape[0]
#
def featureZC(data, threshold=10e-7):
numOfZC = []
channel = data.shape[1]
length = data.shape[0]
for i in range(channel):
count = 0
for j in range(1, length):
diff = data[j, i] - data[j - 1, i]
mult = data[j, i] * data[j - 1, i]
if np.abs(diff) > threshold and mult < 0:
count = count + 1
numOfZC.append(count / length)
return np.array(numOfZC)
def featureSSC(data, threshold=10e-7):
numOfSSC = []
channel = data.shape[1]
length = data.shape[0]
for i in range(channel):
count = 0
for j in range(2, length):
diff1 = data[j, i] - data[j - 1, i]
diff2 = data[j - 1, i] - data[j - 2, i]
sign = diff1 * diff2
if sign > 0:
if (np.abs(diff1) > threshold or np.abs(diff2) > threshold):
count = count + 1
numOfSSC.append(count / length)
return np.array(numOfSSC)
能请教一下 MAV 、WL 、ZC 、SSC4 个函数的都是啥数学公式? 网上搜的那些都搜不到😅
大学数学早就还给老师了.....
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.