Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
417 views
in Technique[技术] by (71.8m points)

python 3.x - Finding parameters of curve with scipy

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.

question from:https://stackoverflow.com/questions/65545373/finding-parameters-of-curve-with-scipy

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...