I'm trying to fit curve with scipy.optimize.curve_fit
.
my data:
x = [3,4,5,6,8,10,12]
y = [30,25,23,22,21,18,14]
func like this
def func(x, b, c, d, a):
return b * (x+a)**c + d
curve_fit parameters
bounds=[-50,50], p0 = [50,-1,10,1], maxfev = 50000)
But as you see, the curve is not very accurate. I assume that I need to use another type of function. Or maybe there another tool for this task? All I need to get formula y = F(x) and predict y-values not only on [3,12], under 3 and above 12 too.
p.s. I have several such x-y lists and maybe there are different functions type in different data
numpy.polyfit
, but I agree with @JohanC, the nature of the source data here is really what's important. More info on the data is necessary for us to provide any reasonable aid. I'd also recommend to scale the axes and plot non-dimensinal data, if you haven't already done so.. with legends. This other post may (or may not) be of help to you: stackoverflow.com/questions/59676871 – Wololo