ca.nengo.math.impl
Class PolynomialCurveFitter
java.lang.Object
ca.nengo.math.impl.PolynomialCurveFitter
- All Implemented Interfaces:
- CurveFitter, java.lang.Cloneable
public class PolynomialCurveFitter
- extends java.lang.Object
- implements CurveFitter
A least-squares polynomial CurveFitter.
See http://mathworld.wolfram.com/LeastSquaresFittingPolynomial.html
TODO: write proper tests
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PolynomialCurveFitter
public PolynomialCurveFitter(int order)
- Parameters:
order
- Order of polynomials used to approximate example points
fit
public Function fit(float[] x,
float[] y)
- Specified by:
fit
in interface CurveFitter
- Parameters:
x
- Example x pointsy
- Example y points (must be same length as x)
- Returns:
- A Function that approximates the mapping Y=f(X) exemplified by x and y.
- See Also:
CurveFitter.fit(float[], float[])
getOrder
public int getOrder()
- Returns:
- Order of polynomials used to approximate points (eg 1 corresponds to linear
approximation, 2 to quadratic, etc)
clone
public CurveFitter clone()
throws java.lang.CloneNotSupportedException
- Specified by:
clone
in interface CurveFitter
- Overrides:
clone
in class java.lang.Object
- Returns:
- Valid clone
- Throws:
java.lang.CloneNotSupportedException
- is clone can't be made