[Numpy-discussion] polyfit on multiple data points

Mathew Yeates myeates@jpl.nasa....
Mon Apr 13 16:59:20 CDT 2009

I understand how to fit  the points (x1,y1) (x2,y2),(x3,y3) with a line 
using polyfit. But, what if I want to perform this task on every row of 
an array?
For instance



and I want the results to be the coefficients  [a,b,c]  and [d,e,f] where
[a,b,c] fits the points (x1,y1) (x2,y2),(x3,y3) and
[d,e,f] fits the points (s1,r1) (s2,r2),(s3,r3)

I realize I could use "apply_along_axis" but I'm afraid of the 
performance penalty. Is there a way to do this without resorting to a 
function call for each row?


More information about the Numpy-discussion mailing list