I'm a total beginner in using curve_fit() of scipy. I don't understand what the problem is in the following code of mine:
import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
def func(x, a, b, c):
return a * np.exp(-b * x) + c
xdata = [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
ydata = [75,66,63,61,60,58,58,55,56,54,56,59,57,57,56,58,56,58,56,56,56]
popt, pcov = curve_fit(func, xdata, ydata)
It returns RuntimeWarning: overflow encountered in exp
Any idea what could be wrong? Thanks in advance!

functo see what arguments it is being called with.