美文网首页
numpy.linspace 等差数列,实现间隔采样

numpy.linspace 等差数列,实现间隔采样

作者: 老王叔叔 | 来源:发表于2017-05-26 16:46 被阅读165次

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

Examples

"start--end--step(不能为负数)"#
>>> np.linspace(2.0, 3.0, num=5) 
array([ 2.  ,  2.25,  2.5 ,  2.75,  3.  ])

"start"--"end"--"step"--"是否包含end这个数(默认True)"#
 >>> np.linspace(2.0, 3.0, num=5, endpoint=False)        
 array([ 2. ,  2.2,  2.4,  2.6,  2.8])

"start"--"end"--"step"--"返回参数step(默认False)"#
>>> np.linspace(2.0, 3.0, num=5, retstep=True)
(array([ 2.  ,  2.25,  2.5 ,  2.75,  3.  ]), 0.25)
wuq.jpg

相关文章

网友评论

      本文标题:numpy.linspace 等差数列,实现间隔采样

      本文链接:https://www.haomeiwen.com/subject/vajxfxtx.html