def Smoothline(t, weight=0.85):
"""
:param t: 需要平滑的列表
:param weight: 值越大,曲线越平滑
:return: 平滑后的列表
"""
scalar = t
last = scalar[0]
smoothed = []
for point in scalar:
smoothed_val = last * weight + (1 - weight) * point
smoothed.append(smoothed_val)
last = smoothed_val
return smoothed
数据处理-曲线平滑(Python)
于 2024-01-31 13:37:11 首次发布