Hi my question is about fitting data in a plot with a smoothed curve.
my x
values look as follows:
[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...60]
my y
values look like this:
[ 1. 1.95 2.83 3.65 4.43 5.19 5.94 6.54 7.39 8.01 8.47 9.03 9.55 10.08 10.78 11.24 11.33 11.96 12.29 12.66 13.11 13.59 13.84 14.23 ...]
I defined my function as follows:
def func(x, a, b, c):
return a * np.log(x*b) + c
and plotted my x
and y
values based on the function above with the library matplotlib
and curfit
function:
popt, pcov = curve_fit(f.func,x,mean, maxfev=10000)
plt.plot(x, y, ls="none", marker='.')
plt.plot(x, f.func(x, *popt),'-')
plt.show()
However the fitted line starts by - 10 but my data starts by (1,1).