# localization by trilateration ( weighted nonlinear least squares )

I am writing an app for beacon localization and I am looking for a formula which, given beacons of known positions and distance from target, finds the target position.

eg.

``````given beacon1 located at (x1,y1), distance from target=d1,
beacon2 located at (x2,y2), distance from target=d2....
find target postion
``````

I have searched a question which seems to be useful: Trilateration algorithm for n amount of points

but for the formula in the above website:

``````fit = NonlinearModelFit[data, Norm[{x, y} - {x0, y0}], {x0, y0}, {x, y}, Weights -> 1/observations^2]
``````

I don't have an idea to implement this in the android app. Also, it said it is using weighted nonlinear least squares fitting. I have searched for it and it is full of matrix and complex steps so I feel lost to implement it.

• Welcome to GIS SE. You recognize that the math/algorithm is "full of matrix and complex steps". It is probably far too much to ask of us to give any specific, detailed help. Study all of the questions on this site on trilateration (or multilateration) in detail, then see if you can ask any more specific questions. – Martin F Jan 22 '15 at 3:13