public class PolynomialFitter
extends java.lang.Object
Polynomial fitting is a very simple case of curve fitting. The estimated coefficients are the polynomial coefficients. They are searched by a least square estimator.
Constructor and Description |
---|
PolynomialFitter(int degree,
DifferentiableMultivariateVectorialOptimizer optimizer)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addObservedPoint(double weight,
double x,
double y)
Add an observed weighted (x,y) point to the sample.
|
void |
clearObservations()
Remove all observations.
|
PolynomialFunction |
fit()
Get the polynomial fitting the weighted (x, y) points.
|
public PolynomialFitter(int degree, DifferentiableMultivariateVectorialOptimizer optimizer)
The polynomial fitter built this way are complete polynomials, ie. a n-degree polynomial has n+1 coefficients.
degree
- maximal degree of the polynomialoptimizer
- optimizer to use for the fittingpublic void addObservedPoint(double weight, double x, double y)
weight
- weight of the observed point in the fitx
- abscissa of the pointy
- observed value of the point at x, after fitting we should
have P(x) as close as possible to this valuepublic void clearObservations()
public PolynomialFunction fit() throws OptimizationException
OptimizationException
- if the algorithm failed to converge"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"