您好,欢迎来到华佗小知识。
搜索
您的当前位置:首页numpy.linspace 等差数列,实现间隔采样

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

来源:华佗小知识

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

Copyright © 2019- huatuo0.cn 版权所有

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务