0

Hi guys I'm using scipy optimize curve fit to find the best curve for my data. The data and the function that I'm using are

X = [231. , 845. , 275. , 935.9, 927.6, 803. , 707. , 890. , 934.3, 939.1, 931.7, 613. , 925. , 822.2, 913. , 899.7,   1. ]
Y = [12.4,11,12.3,2.6,9,11.5,12,10.5,3.9,0.7,5,12.3,6.5,11.4,10,9.6,12.5]

def IV(x,a,b):
    return a*np.exp(b*x)

params, params_covariance = optimize.curve_fit(IV, X, Y)
a = params[0]
b = params[1]

But I get two errors:

<ipython-input-6-c32b0762eb3a>:6: RuntimeWarning: overflow encountered in exp
  return a*np.exp(b*x)

RuntimeError: Optimal parameters not found: Number of calls to function has reached maxfev = 600.

Right now I trying using maxfev = 1000000000 but it is taking forever.

Mario
  • 1
  • Does this answer your question? [Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000](https://stackoverflow.com/questions/15831763/scipy-curvefit-runtimeerroroptimal-parameters-not-found-number-of-calls-to-fun) – illusionx Jan 03 '21 at 00:07
  • For a start - you should provide sensible [start parameters `p0`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html). But then again - have you plotted your data? How is this curve form supposed to be represented by your function? – Mr. T Jan 04 '21 at 11:46

0 Answers0