ca.uol.aig.fts.fitting
Class PolynomialFitting

java.lang.Object
  extended by ca.uol.aig.fts.fitting.PolynomialFitting

public class PolynomialFitting
extends java.lang.Object

PolynomialFitting uses weighted lease-square methods to fit a 1-D curve.


Constructor Summary
PolynomialFitting(int polyDegree)
          Constructor.
 
Method Summary
 void fit(double[] x, double[] y, double[] weights)
          using these parameters to get a least square fitting.
 double[] getFittingParam()
          get the fitting parameters.
 double[] getResult(double[] x)
          using the fitting polynomial to get the new x-y curve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolynomialFitting

public PolynomialFitting(int polyDegree)
Constructor.

Parameters:
polyDegree - the degree of the fitting polynomial.
Method Detail

fit

public void fit(double[] x,
                double[] y,
                double[] weights)
using these parameters to get a least square fitting.

Parameters:
x - the coordinates
y - the values, y = y(x).
weights - the weights of every x.

getFittingParam

public double[] getFittingParam()
get the fitting parameters.

Returns:
the fitting parameters

getResult

public double[] getResult(double[] x)
using the fitting polynomial to get the new x-y curve

Parameters:
x - the new coordinates
Returns:
the new values corresponding to x