Sep-18-2019, 08:20 AM

Hi,

I have fitted a function for extrapolation and now I would like to get the x value when y is of a certain value. How do I get this?

I have fitted a function for extrapolation and now I would like to get the x value when y is of a certain value. How do I get this?

def func(x, b1, b2): return b1*np.exp(-b2*(x)) x = np.array([47,77,103,129,152,177,207,234,255,282,311,337,358,382,416,440,463,490,512,535,566,573]) y = np.array([0.904996,0.946489,0.931208,0.930137,0.915004,0.92138,0.911744,0.908241,0.894834,0.895659,0.897973,0.885373,0.895916,0.883586,0.880162,0.857255,0.872408,0.87055,0.855421,0.854406,0.852419,0.853073]) popt, pcov = curve_fit(func, x, y, p0=[0.1,0.1]) plt.plot(x, y, 'x') xx = np.linspace(0, 2000, 100) yy = func(xx, *popt) plt.plot(xx, yy, lw=1)Thanks.