我试图生成一个遵循精确高斯分布的数组。np.随机.正态高斯随机抽样的意思是,我可以用高斯随机抽样。所以数组将产生一个柱状图,它遵循一个精确的高斯分布,而不仅仅是下面所示的近似高斯分布。在
mu, sigma = 10, 1
s = np.random.normal(mu, sigma, 1000)
fig = figure()
ax = plt.axes()
totaln, bbins, patches = ax.hist(s, 10, normed = 1, histtype = 'stepfilled', linewidth = 1.2)
plt.show()
如果你想要一个精确的高斯直方图,不要生成点。你可以从观测点得到一个“精确的”高斯分布,仅仅是因为你不能在一个直方图单元内有一个点的分数。在
相反,以条形图的形式绘制曲线。在
相关问题 更多 >
编程相关推荐