Least squares polynomial fit.
Fit a polynomial p(x) = p[0] * x**deg + ... + p[deg] of degree deg to points (x, y). Returns a vector of coefficients p that minimises the squared error.
Parameters : | x : array_like, shape (M,)
y : array_like, shape (M,) or (M, K)
deg : int
rcond : float, optional
full : bool, optional
w : array_like, shape (M,), optional
cov : bool, optional
|
---|---|
Returns : | p : ndarray, shape (M,) or (M, K)
residuals, rank, singular_values, rcond : present only if full = True
V : ndaray, shape (M,M) or (M,M,K)
|
Warns : | RankWarning :
|
See also
Notes
Any masked values in x is propagated in y, and vice-versa.
References
[R50] | Wikipedia, “Curve fitting”, http://en.wikipedia.org/wiki/Curve_fitting |
[R51] | Wikipedia, “Polynomial interpolation”, http://en.wikipedia.org/wiki/Polynomial_interpolation |
Examples