I'm trying to do an exponential fit on various points (x,y) with the formula A*EXP(-BX), trying to find A and B that best suit my points.
double[] xx = curveFitter.fit(new ParametricUnivariateFunction() {
public double value(double v, double... doubles) {
return doubles[0] * Math.exp(-1 * doubles[1] * v);
}
public double[] gradient(double v, double... doubles) {
return new double[]{v, 1};
}
}, new double[]{0, 0});
I get some numbers but they don't fit my points in any way, Can't seem to find any documentation on the above.
Using commons-math3-3.0