Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curve fitting with python

I'm trying to fit some data and stuff, I know there is a simple command to do this with python/numpy/matplotlib, but I can't find it. I think it is something like

popt,popc = numpy.curvefit(f,x)

where popt is the paramters of f, popc is the fit quality and f is a predefined function of f. Does any of you know it?

like image 516
Yotam Avatar asked Nov 26 '11 19:11

Yotam


People also ask

What is the formula for curve fitting?

The curve follows equation A42 with a = 5, b = -1, c = -5 and d = 1. The Trendline type is Polynomial. The highest-order polynomial that Trendline can use as a fitting function is a regular polynomial of order six, i.e., y = ax6 + bx5 +cx4 + ak3 + ex2 +fx + g. polynomials such as y = ax2 + bx3'2 + cx + + e.


1 Answers

Take a look at scipy.optimize.curve_fit:

scipy.optimize.curve_fit(f, xdata, ydata, p0=None, sigma=None, **kw)

Use non-linear least squares to fit a function, f, to data.

like image 193
ars Avatar answered Oct 07 '22 16:10

ars