【发布时间】:2020-10-05 07:00:28
【问题描述】:
我目前正在尝试使用 CiLEO 作为参考来实现 NASA 分解模型。我对如何实现作者定义的特征长度感到非常困惑:
“对于 CiELO 中的实现,特征长度被划分为 100 个在 1 mm 到 10 cm 之间的对数刻度上等距间隔的 bin:计算每个 bin 的片段数,一旦每个片段分配给一个bin,其特征长度是使用内置的matlab函数rand定义的,以提取bin内Lc的随机值。”
我的问题是最后一个组件,在每个 bin 中提取一个随机值来定义长度。我在网上找不到任何关于如何在给定 bin 边缘的每个 bin 中选择一个值的信息。
为了便于演示,我目前将片段数函数定义为:
def number_of_fragments(length):
return 0.1*length**-1.71
# Generating 100 bins evenly spaced on a log scale between 1mm (0.001 m) and 10cm (0.1 m)
bins = np.geomspace(0.001, 0.1, 100)
# Finding the corresponding number of fragments for each bin
fragments = [number_of_fragments(b) for b in bins]
# Need to pick a random value that falls in the range of each bin
Lc = ???
对此的任何帮助将不胜感激!
【问题讨论】:
-
我相信 Matlab rand 默认返回一个介于 0 和 1 之间的统一随机值,但如果您指定一个范围,它将从中采样。
标签: python numpy statistics histogram simulation