import matplotlib.pylab as plt
x = [0.999,0.9995, 0.9999,0.99993, 0.99995,0.99998, 0.99999]
y = [30, 50, 80, 120, 150, 400, 500]
plt.plot(x,y,'o')
您好!
我想通过使用scipy或其他东西从两个列表中提取数学函数。
有办法吗?
答案 0 :(得分:1)
您可以使用scipy
import matplotlib.pylab as plt
from scipy import interpolate
import numpy as np
x = [0.999,0.9995, 0.9999,0.99993, 0.99995,0.99998, 0.99999]
y = [30, 50, 80, 120, 150, 400, 500]
x_new = np.linspace(0.999,1,40)
fnc = interpolate.interp1d(x,y,fill_value='extrapolate')
y_new = fnc(x_new)
plt.plot(x,y,'o',x_new,y_new)
plt.show()
或者,如果您有适合自己的功能,可以探索curve fitting