根据已知坐标的N点距离确定3D空间中点的位置 [英] Determine the position of a point in 3D space given the distance to N points with known coordinates

查看:123
本文介绍了根据已知坐标的N点距离确定3D空间中点的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图确定点p的(x,y,z)坐标。我所拥有的是到已知坐标的4个不同点m1,m2,m3,m4的距离。

详细说明:我得到的是4点坐标(m1 ,m2,m3,m4),它们不在同一平面上:

  m1:(x1,y1,z1), 

m2:(x2,y2,z2),

m3:(x3,y3,z3),

m4:(x4,y4 ,z4)

和欧几里得距离形式m1-> p,m2-> p,m3-> p和m4-> p是

  D1 = sqrt((x-x1)^ 2 +(y-y1)^ 2 +(z-z1)^ 2); 

D2 = sqrt((x-x2)^ 2 +(y-y2)^ 2 +(z-z2)^ 2);

D3 = sqrt((x-x3)^ 2 +(y-y3)^ 2 +(z-z3)^ 2);

D4 = sqrt((x-x4)^ 2 +(y-y4)^ 2 +(z-z4)^ 2);

我正在寻找(x,y,z)。我尝试通过采用欧几里得距离来解决这个非线性系统的4个方程和3个未知数与matlab fsolve,但没有管理。



有两个问题:


  1. 如何找到未知坐标点p:(x,y,z)
  2. 什么是已知坐标的最小点数m,以及我需要找到的
    距离p的距离(x, y,z)?

编辑:

没有解决方案的代码:

可以说我拥有的点是:

  m1 = [370; 1810; 863]; 

m2 = [1586; 185; 1580];

m3 = [1284; 1948年; 348];

m4 = [1732; 1674; 1974];

x = cat(2,m1,m2,m3,m4)';

每个点到p的距离都是

  d = [1387.5; 1532.5; 1104.7; 0855.6] 

根据我的理解,如果我想运行fsolve,我必须使用以下代码:
1.创建一个函数
2.调用fsolve

 函数F = calculateED(p)

m1 = [370; 1810; 863];

m2 = [1586; 185; 1580];

m3 = [1284; 1948年; 348];

m4 = [1732; 1674; 1974];

x = cat(2,m1,m2,m3,m4)';

d = [1387.5; 1532.5; 1104.7; (1,1)^ 2 - (p(1)-x(1,1))^ 2 - (p(2)-x(1,2) )^ 2 - (p(3)-x(1,3))^ 2; (2)-x(2,2))^ 2-(p(3) - (p(1)-x(2,1))^ 2 - X(2,3))^ 2; (p(3))^ 2 - (p(1)-x(3,1))^ 2 - (p(2)-x(3,2))^ 2-(p(3) - X(3,3))^ 2; (2)-x(4,2))^ 2-(p(3) - (p(1)-x(4,1))^ 2 - X(4,3))^ 2;];

然后调用fsolve:

  p0 = [1500,1500,1189]; %初始猜测
options = optimset('算法',{'levenberg-marquardt',。001},'Display','iter','TolX',1e-1);
[p,Fval,exitflag] = fsolve(@ calculateED,p0,options);

我正在运行Matlab 2011b。



我错过了什么?



最小二乘法解决方案如何?



这里有一点需要注意,m1, m2,m3,m4和d值可能无法准确给出,但对于一个不应该成为问题的分析解决方案而言。

解决方案

mathematica容易numericl解决了三点问题:

$ $ p $ $ $ c $ p>表[RandomReal [{ - 1,1},{3} ],{3}]
r = RandomReal [{1,2},{3}]
Reduce [简化[表[Norm [{x,y,z} - p [[i]]] == r [[i]],{i,3}],
假设 - > {元素[x | y | z,Reals]}],{x,y,z},Reals]

false 随机球体通常不会有三个相交点。



当您有解决方案时,这样的一对。

 (*(x == -0.218969&& y == ==.760452&&& ; z == -0.136958)|| 
(x == 0.725312&& y == == 0.466006&& z == -0.290347)*)

这有点令人惊讶地具有失败的elegent分析解决方案。它有点牵扯,所以我会等待,看看是否有人有它的方便,如果没有,并有兴趣,我会尽量记住的步骤..



编辑, Dmitys最小二乘法建议的近似解法:

  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}]
表[Norm [solution -p [[i]]],{i,4}]

正如你所看到的,你距离确切的距离还很遥远......

 解决方案点{1761.3,1624.18,1178.65} *)
(*解决方案半径:{1438.71,1504.34,1011.26,797.446} *)


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: what I have is the coordinates of 4 points (m1,m2,m3,m4) and they are not in the same plane:

m1: (x1,y1,z1),

m2: (x2,y2,z2),

m3: (x3,y3,z3),

m4: (x4,y4,z4)

and the Euclidean distances form m1->p, m2->p, m3->p and m4->p which are

D1 = sqrt( (x-x1)^2 + (y-y1)^2 + (z-z1)^2);

D2 = sqrt( (x-x2)^2 + (y-y2)^2 + (z-z2)^2);

D3 = sqrt( (x-x3)^2 + (y-y3)^2 + (z-z3)^2);

D4 = sqrt( (x-x4)^2 + (y-y4)^2 + (z-z4)^2);

I am looking for (x,y,z). I tried to solve this non-linear system of 4 equations and 3 unknowns with matlab fsolve by taking the euclidean distances but didn't manage.

There are two questions:

  1. How can I find the unknown coordinates of point p: (x,y,z)
  2. What is the minimum number of points m with known coordinates and distances to p that I need in order to find (x,y,z)?

EDIT:

Here is a piece of code that gives no solutions:

Lets say that the points I have are:

m1 = [ 370; 1810;  863];

m2 = [1586;  185; 1580];

m3 = [1284; 1948;  348];

m4 = [1732; 1674; 1974];

x = cat(2,m1,m2,m3,m4)';

And the distance from each point to p are

d = [1387.5; 1532.5; 1104.7; 0855.6]

From what I understood if I want to run fsolve I have to use the following: 1. Create a function 2. Call fsolve

function F = calculateED(p)

m1 = [ 370; 1810;  863];

m2 = [1586;  185; 1580];

m3 = [1284; 1948;  348];

m4 = [1732; 1674; 1974];

x = cat(2,m1,m2,m3,m4)';

d = [1387.5; 1532.5; 1104.7; 0855.6]

F = [d(1,1)^2 - (p(1)-x(1,1))^2 - (p(2)-x(1,2))^2 - (p(3)-x(1,3))^2;
 d(2,1)^2 - (p(1)-x(2,1))^2 - (p(2)-x(2,2))^2 - (p(3)-x(2,3))^2;
 d(3,1)^2 - (p(1)-x(3,1))^2 - (p(2)-x(3,2))^2 - (p(3)-x(3,3))^2;
 d(4,1)^2 - (p(1)-x(4,1))^2 - (p(2)-x(4,2))^2 - (p(3)-x(4,3))^2;];

and then call fsolve:

p0 = [1500,1500,1189];  % initial guess
options = optimset('Algorithm',{'levenberg-marquardt',.001},'Display','iter','TolX',1e-1);                     
[p,Fval,exitflag] = fsolve(@calculateED,p0,options);

I am running Matlab 2011b.

Am I missing something?

How would the least squares solution be?

One note here is that m1, m2, m3, m4 and d values may not be given accurately but for an analytical solution that shouldn't be a problem.

解决方案

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} *)

这篇关于根据已知坐标的N点距离确定3D空间中点的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆