The concept is that each base generates a measurement with noise of its distance to the device.
Geometrically, the measurement defines a circle around the base station.

enter image description here

The idea is to find a location within the square which its distance is most similar to the 3 given distances.
In case of noiseless measurements all circles will have a single intersection point.
In real world case, one must find a reasonable solution, such as the point which minimizes:

$$ \hat{\boldsymbol{\beta}} = \arg \min_{\boldsymbol{\beta}} \sum_{i = 1}^{m} {w}_{i} \left( {y}_{i} - {\left\| \boldsymbol{\beta} - \boldsymbol{x}_{i} \right\|}_{2}^{2} \right)^{2} $$

Where

  • $\boldsymbol{x}_{i}$ - The coordinates of the $i$ -th base station.
  • ${y}_{i}$ - The squared measurement of the $i$ -th base station. I use the squared distance to simplify the calculation of the gradient of the objective.
  • $\boldsymbol{\beta}$ - The location of the solution.
  • ${w}_{i}$ - The weight of the $i$ -th base station. The higher the value the more accurate the $i$ -th measurement is believed to be.

The optimization problem can be solved using the Levenberg Marquardt Algorithm.
In this specific case it converges in ~6 iterations:

enter image description here

The solution does not match the ground truth due to the added noise. Yet it is close.


The code is available on my StackExchange GitHub Repository (Look at the DataScience\Q113445 folder).