【发布时间】:2015-06-30 23:01:53
【问题描述】:
这可能是一个简单的问题,但我想不通。
假设我有一个这样的数据集:
180.0
170.9
-180.0
0.00
50.0
...
我一直在使用 numpy.histogram 函数来获取 -180 到 180 范围内的概率值
probs, ang = np.histogram(angles, bins=360, range=(-180,180))
但是它返回一个长度不等的 hist 数组和 bin_edges 数组
返回:
历史:数组
直方图的值。有关可能语义的描述,请参见 normed 和 weights。
bin_edges : dtype 浮点数组
返回 bin 边缘 (length(hist)+1)。
如何获得我的数据集的概率,其中我的范围内的每个数字(-180 到 180,包括零)都具有与之相关的概率,例如:
range prob
-180 0.70
-170 0.01
-160 0.01
我需要概率与范围匹配
我是这样在matlab中做的
[probas, angles] = hist(x, -180:10:180, 1.0);
这看起来很相似,但不起作用。
【问题讨论】:
标签: python matlab numpy histogram probability