lemmingapex / trilateration

Solves a formulation of n-D space trilateration problem using a nonlinear least squares optimizer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not issue, just question about accuracy

kikothemaster opened this issue · comments

Is it possible to get accuracy value from solver?

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.