生成固定范围的数组
生成固定范围的数组
np.linspace(start, stop, num, endpoint)
- 创建等差数组-指定数量
- 参数
- start: 序列的起始值
- stop: 序列 的终止值
- num: 要生成的等间隔样例数量,默认50。即序列元素的个数
- endpoint: 序列中是否包含stop值,默认True
np.arrange(start, stop, step, dtype)
- 创建等差数组- 指定步长
- 参数
- step: 步长,默认为1
np.logspace(start, stop, num)
- 创建等比数列
- 参数
- num: 要生成的等比数列的元素个数,默认为50
- 如:
np.logspace(0, 2, 3)
结果为array([1., 10., 100.])
即, ,