所以基本上我有一些数据,我需要找到一种方法来平滑它(这样从它生成的线是平滑的,而不是抖动的)。当绘制出数据时,现在看起来如下:
我试着用thisnumpy方法得到这条线的方程,但它对我不起作用,因为曲线重复(有多个读数,所以曲线上升,饱和,然后下降,然后重复多次),所以没有一个真正的方程可以表示这一点
我也试过this,但由于上述原因,它没有起作用
该图定义如下:
gx = [] #x is already taken so gx -> graphx
gy = [] #same as above
#Put in data
#Get nice data #[this is what I need help with]
#Plot nice data and original data
plt.xlabel('x')
plt.ylabel('y')
plt.legend()
plt.show()
我认为最适用于我的解决方案的方法是获得每2个点的平均值,并将其设置为两个点的值,但我不同意这种想法-潜在值可能会丢失
您可以使用无限地平线过滤器
我算出了,通过平均4个结果,我能够显著地平滑图表。下面是一个演示:
希望这能帮助任何需要它的人
相关问题 更多 >
编程相关推荐