Spline Interpolation with Python

前端 未结 3 1990
醉酒成梦
醉酒成梦 2020-12-15 08:37

I wrote the following code to perform a spline interpolation:

import numpy as np
import scipy as sp

x1 = [1., 0.88,  0.67,  0.50,  0.35,  0.27, 0.18,  0.11,         


        
3条回答
  •  暖寄归人
    2020-12-15 09:03

    I've just got the above error and fixed it with remove duplicated value in the X and Y array.

    x = np.sort(np.array([0, .2, .2, .4, .6, .9]))
    y = np.sort(np.sort(np.array([0, .1, .06, .11, .25, .55]))
    

    ⬇ Change 0.2 to 0.3 or any number.

    x = np.sort(np.array([0, .2, .3, .4, .6, .9]))
    y = np.sort(np.sort(np.array([0, .1, .06, .11, .25, .55]))
    

提交回复
热议问题