Determine the position of a point in 3D space given the distance to N points with known coordinates

前端 未结 3 1654
自闭症患者
自闭症患者 2020-12-30 17:52

I am trying to determine the (x,y,z) coordinates of a point p. What I have are the distances to 4 different points m1, m2, m3, m4 with known coordinates.

In detail:

3条回答
  •  北海茫月
    2020-12-30 18:13

    mathematica readily numericall solves the three point problem:

    p = Table[ RandomReal[{-1, 1}, {3}], {3}]
    r = RandomReal[{1, 2}, {3}]
    Reduce[Simplify[ Table[Norm[{x, y, z} - p[[i]]] == r[[i]] , {i, 3}], 
          Assumptions -> {Element[x | y | z, Reals]}], {x, y, z}, Reals]
    

    This will typically return false as random spheres will typically not have triple intersection points.

    When you have a solution you'll typically have a pair like this..

          (*   (x == -0.218969 && y == -0.760452 &&  z == -0.136958) ||
               (x == 0.725312 && y == 0.466006 &&   z == -0.290347)  *)
    

    This somewhat surprisingly has a failrly elegent analytic solution. Its a bit involved so I'll wait to see if someone has it handy and if not and there is interest I'll try to remember the steps..

    Edit, approximate solution following Dmitys least squares suggestion:

    p = {{370, 1810, 863}, {1586, 185, 1580}, {1284, 1948, 348}, {1732, 
    1674, 1974}};
    r = {1387.5, 1532.5, 1104.7, 0855.6};
    solution = {x, y, z} /. 
                  Last@FindMinimum[ 
                         Sum[(Norm[{x, y, z} - p[[i]]] - r[[i]] )^2, {i, 1, 4}] , {x, y, z}]
    Table[ Norm[ solution - p[[i]]], {i, 4}]
    

    As you see you are pretty far from exact..

    (* solution point {1761.3, 1624.18, 1178.65} *)
    (* solution radii: {1438.71, 1504.34, 1011.26, 797.446} *)
    

提交回复
热议问题