python np.linspace

该函数的形式为:

linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None)

作用为:在规定的时间内,返回固定间隔的数据。他将返回“num”个等间距的样本,在区间[`start`, `stop`]中。其中,区间的结束端点可以被排除在外。

参数:

start : scalar

  队列的开始值

stop : scalar

 队列的结束值。当‘endpoint=False’时,不包含该点。在这种情况下,队列包含除了“num+1"以外的所有等间距的样本。

要注意的是,当‘endpoint=False’时,步长会发生改变。

num : int, optional

要生成的样本数。默认是50,必须要非负。

endpoint : bool, optional

如果是True,’stop'是最后的样本。否则,'stop'将不会被包含。默认为true

retstep : bool, optional

If True, return (`samples`, `step`), where `step` is the spacing between samples.

返回值:

samples : ndarray

在闭区间[start, stop]或者是半开区间[start, stop)中有num个等间距的样本

step : float

仅仅当”retstep=True“时候会返回。样本之间间距的大小

原文地址:https://www.cnblogs.com/xiaohua92/p/5525871.html