org.apache.commons.math.optimization.fitting
Class PolynomialFitter

java.lang.Object
  extended by org.apache.commons.math.optimization.fitting.CurveFitter
      extended by org.apache.commons.math.optimization.fitting.PolynomialFitter

public class PolynomialFitter
extends CurveFitter

This class implements a curve fitting specialized for polynomials.

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.

Since:
2.0
Version:
$Id: PolynomialFitter.java 1131229 2011-06-03 20:49:25Z luc $

Constructor Summary
PolynomialFitter(int degree, DifferentiableMultivariateVectorialOptimizer optimizer)
          Simple constructor.
 
Method Summary
 double[] fit()
          Get the polynomial fitting the weighted (x, y) points.
 
Methods inherited from class org.apache.commons.math.optimization.fitting.CurveFitter
addObservedPoint, addObservedPoint, addObservedPoint, clearObservations, fit, fit, getObservations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolynomialFitter

public PolynomialFitter(int degree,
                        DifferentiableMultivariateVectorialOptimizer optimizer)
Simple constructor.

The polynomial fitter built this way are complete polynomials, ie. a n-degree polynomial has n+1 coefficients.

Parameters:
degree - Maximal degree of the polynomial.
optimizer - Optimizer to use for the fitting.
Method Detail

fit

public double[] fit()
Get the polynomial fitting the weighted (x, y) points.

Returns:
the coefficients of the polynomial that best fits the observed points.
Throws:
ConvergenceException - if the algorithm failed to converge.


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.