作为numpy.linspace给出线性连接的两点之间的等距点。我能得到沿着连接一组点的直线的等距点吗。在
例如:
import numpy as np
npts = 10
xcoords, ycoords = [0,1], [0,1]
xquery = np.linspace(xcoords[0],xcoords[1], npts)
yquery = np.linspace(ycoords[0],ycoords[1], npts)
这里我需要在连接一组点的线上等距离的查询点
^{pr2}$
Tags:
等长部分的二维分段线的细分:
编辑:为了澄清这个答案只提供了x方向上的等距点。我对这个问题的误解
我相信你要找的是插值法? 文件scipy.插值在这里:https://docs.scipy.org/doc/scipy-1.0.0/reference/tutorial/interpolate.html#d-interpolation-interp1d
但为了快速展示您的例子:
然后在f中输入您希望查询的新x点,如下所示(xnew不能超过x的最小/最大界限)
^{pr2}$看一看就是情节
相关问题 更多 >
编程相关推荐