如果每个数据集中都有相同数量的点(示例中没有,但在文章中声明了),则可以只得到每个数据集的平均值
x
每组的值,以及
y
this post
例如,给出了你的数据,但每个数据有9个点:
>>> x1
array([0. , 0.0100523, 0.0201047, 0.030157 , 0.0402094, 0.0502617,
0.060314 , 0.0703664, 0.0804187])
>>> y1
array([100. , 65.1077, 64.0519, 63.0341, 62.1309, 61.3649,
60.8614, 60.3555, 59.7635])
>>> x2
array([0. , 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08])
>>> y2
array([100. , 66.119 , 64.4593, 63.1377, 62.0386, 61.0943,
60.2811, 59.5603, 58.8908])
你可以:
import numpy as np
mean_x = np.mean((x1,x2), axis=0)
mean_y = np.mean((y1,y2), axis=0)
什么时候可以直观地显示,你可以绘图。在这里,黑线是您的平均线,蓝线和橙线是您的原始数据集:
import matplotlib.pyplot as plt
plt.plot(x1,y1)
plt.plot(x2,y2)
plt.plot(mean_x,mean_y, color='black')
plt.show()