Skip to main content

polyfit

Function polyfit 

Source
pub fn polyfit(x: &[f64], y: &[f64], degree: usize) -> Option<Vec<f64>>
Expand description

Least-squares polynomial fit (silx uses numpy.polyfit).

Returns degree + 1 coefficients highest-power-first (the numpy.polyfit / numpy.poly1d convention), solving the normal equations (VᵀV) c = Vᵀy over the Vandermonde matrix V. Returns None when the lengths differ, the data is empty, there are fewer than degree + 1 points, or the normal-equation matrix is singular. Normal equations are adequate for the low degrees silx uses (2–5); they are more sensitive to conditioning than numpy.polyfit’s SVD for high degrees.