polyfit with multi-dimensional x coordinate

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

polyfit with multi-dimensional x coordinate

lelouchkako
This post has NOT been accepted by the mailing list yet.
Hello.
Suppose that I have a (400,10) array called x and a (400,10) array called y. Is that possible to do a polyfit of each row in y to the corresponding row in x without iteration? For example, if I use for loop it will be something like

coe = np.zeros((400,3))
for i in np.arange(y.shape[0]):
    coe[i,:] = np.polyfit(x[i,:], y[i,:], 2)


Because the 400 rows in x is totally different, I cannot just apply np.polyfit with the same x coordinate to a multi-dimensional array y.

Loading...