Closed kikothemaster closed 4 years ago
You can use the .getSigma() function to obtain an error radius. Something like this should do roughly what you want (RealVector is from org.apache.commons.math3.linear):
NonLinearLeastSquaresSolver solver = new NonLinearLeastSquaresSolver(trilaterationFunction, new LevenbergMarquardtOptimizer());
Optimum optimum = solver.solve();
RealVector standardDeviation = optimum.getSigma(0);
double errorRadius = ((standardDeviation.getEntry(0) + standardDeviation.getEntry(1)) / 2); //This gets an average of the ellipsoidal radius
You can alternatively get the largest of the two distances:
if (standardDeviation.getEntry(1) > standardDeviation.getEntry(0))
{
errorRadius = standardDeviation.getEntry(1);
} else {
errorRadius = standardDeviation.getEntry(0);
}
These above only look at the X,Y values, not the Z value.
Is it possible to get accuracy value from solver?