I am working on a local positioning project, but with a such a high degree of error in the measured distance of signals from the beacons, the final location has what appears to be an amplified amount of error.
The current implementation is using an ${n \choose 3}$ trilateration where each group of 3 beacons is trilaterated to get an $(x, y)$ pair. Then the final position is found by averaging each $x$ and $y$ from $\{(x, y)\}$.
I feel like better results could be obtained if all $(x, y)$ pairs could be used simultaneously instead of averaging the results of each group of 3. That is why I am looking into weighted nonlinear least squares fitting of circles. My research shows this to be a good option.
I am looking to be able to do exactly this which uses Mathematica's NonlinearModelFit function, but without having to rely on a library to do it. The answer in the link also has a helpful graphic in how a final position should look with the given data.
Not being a math person, I am at a loss on how this algorithm works "under the covers" and am needing to implement it in code in my system. Can anyone provide some pseudo-code of the steps involved? The data I can provide the algorithm is a set of $(x, y, distance)$ tuples where $x$ and $y$ are known points of each beacon and the distance is a measured, yet error-prone proximity from the point.
I am open to other suggestions for algorithms as well.