How to solve 3 TDOA equations with 3 variables x,y,z
15 次查看(过去 30 天)
显示 更早的评论
I have a set of equations which looks like that, how to find x,y,z by coding while all other variables are known?
采纳的回答
Torsten
2022-1-21
Code for symbolic solution:
syms x y z
x1 = 0.60; y1 = 0.00; z1 = 0.70;
x2 = 0.20; y2 = 1.30; z2 = 0.70;
x3 = 0.80; y3 = 1.05; z3 = 0.20;
x4 = 0.00; y4 = 0.25; z4 = 0.20;
a = 0.19845; b = 0.08791; c = 0.11492;
eqn1 = a==sqrt((x-x2)^2+(y-y2)^2+(z-z2)^2) - sqrt((x-x1)^2+(y-y1)^2+(z-z1)^2);
eqn2 = b==sqrt((x-x3)^2+(y-y3)^2+(z-z3)^2) - sqrt((x-x1)^2+(y-y1)^2+(z-z1)^2);
eqn3 = c==sqrt((x-x4)^2+(y-y4)^2+(z-z4)^2) - sqrt((x-x1)^2+(y-y1)^2+(z-z1)^2);
S = solve([eqn1,eqn2,eqn3],[x,y,z])
xnum = double(S.x)
ynum = double(S.y)
znum = double(S.z)
Code for fsolve:
X0 = [1,1,1];
x1 = 0.60; y1 = 0.00; z1 = 0.70;
x2 = 0.20; y2 = 1.30; z2 = 0.70;
x3 = 0.80; y3 = 1.05; z3 = 0.20;
x4 = 0.00; y4 = 0.25; z4 = 0.20;
a = 0.19845; b = 0.08791; c = 0.11492;
fun=@(x,y,z)[a-(sqrt((x-x2)^2+(y-y2)^2+(z-z2)^2) - sqrt((x-x1)^2+(y-y1)^2+(z-z1)^2)), ...
b-(sqrt((x-x3)^2+(y-y3)^2+(z-z3)^2) - sqrt((x-x1)^2+(y-y1)^2+(z-z1)^2)), ...
c-(sqrt((x-x4)^2+(y-y4)^2+(z-z4)^2) - sqrt((x-x1)^2+(y-y1)^2+(z-z1)^2))];
X = fsolve(@(x)fun(x(1),x(2),x(3)),X0);
x = X(1)
y = X(2)
z = X(3)
2 个评论
Venkata Naresh
2023-11-22
Hi, In the code you provided, what does the values a = 0.19845; b = 0.08791; c = 0.11492;
mean
Torsten
2023-11-22
编辑:Torsten
2023-11-22
You are given four points X1, X2, X3 and X4 in three-dimensional space.
You search for a fifth point X for which
the distance difference between (X and X2) and (X and X1) is "a"
the distance difference between (X and X3) and (X and X1) is "b"
the distance difference between (X and X4) and (X and X1) is "c"
Here, a, b and c are given values.
I don't know the application behind this problem, maybe in surveying and mapping.
If you are interested, you should google "TDOA equations" from the title of the message.
更多回答(1 个)
Torsten
2022-1-21
If there are no specialized methods to solve the TDOA equations (did you take a look into the literature ?), I suggest trying
syms x1 x2 x3 x4 y1 y2 y3 y4 z1 z2 z3 z4 x y z a b c
eqn1 = a==sqrt((x-x2)^2+(y-y2)^2+(z-z2)^2) - sqrt((x-x1)^2+(y-y1)^2+(z-z1)^2);
eqn2 = b==sqrt((x-x3)^2+(y-y3)^2+(z-z3)^2) - sqrt((x-x1)^2+(y-y1)^2+(z-z1)^2);
eqn3 = c==sqrt((x-x4)^2+(y-y4)^2+(z-z4)^2) - sqrt((x-x1)^2+(y-y1)^2+(z-z1)^2);
S = solve([eqn1,eqn2,eqn3],[x,y,z])
If this is not successful, use "fsolve".
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numbers and Precision 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!