scipy: Interpolating trajectory

后端 未结 1 1040
半阙折子戏
半阙折子戏 2021-02-08 07:47

I have a trajectory formed by a sequence of (x,y) pairs. I would like to interpolate points on this trajectory using splines.

How do I do this? Using scip

1条回答
  •  暖寄归人
    2021-02-08 08:17

    Using splprep you can interpolate over curves of any geometry.

    from scipy import interpolate
    tck,u=interpolate.splprep([x,y],s=0.0)
    x_i,y_i= interpolate.splev(np.linspace(0,1,100),tck)
    

    Which produces a plot like the one given, but only using the x and y points and not the alpha and r paramters. Same as yours only using x and y points.

    Sorry about my original answer, I misread the question.

    0 讨论(0)
提交回复
热议问题