Skip to main content

poly_fit

Function poly_fit 

Source
pub fn poly_fit(
    xs: &[f64],
    ys: &[f64],
    degree: usize,
) -> Result<Vec<f64>, InterpolationError>
Expand description

Fit a degree-degree polynomial to (xs, ys) in the least-squares sense. Returns coefficients in ascending order [c₀, c₁, …, c_degree] (so the polynomial is Σ cₖ xᵏ). Fails closed if there are too few points or the system is singular.