numpy.polynomial.legendre.legfit()

numpy.polynomial.legendre.legfit

numpy.polynomial.legendre.legfit(x, y, deg, rcond=None, full=False, w=None) [source]

Least squares fit of Legendre series to data.

Return the coefficients of a Legendre series of degree deg that is the least squares fit to the data values y given at points x. If y is 1-D the returned coefficients will also be 1-D. If y is 2-D multiple fits are done, one for each column of y, and the resulting coefficients are stored in the corresponding columns of a 2-D return. The fitted polynomial(s) are in the form