How to solve 3 TDOA equations with 3 variables x,y,z
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ebrahim Abdullah Ahmed Albabakri
le 21 Jan 2022
Modifié(e) : Torsten
le 22 Nov 2023
I have a set of equations which looks like that, how to find x,y,z by coding while all other variables are known?
2 commentaires
Réponse acceptée
Torsten
le 21 Jan 2022
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 commentaires
Venkata Naresh
le 22 Nov 2023
Hi, In the code you provided, what does the values a = 0.19845; b = 0.08791; c = 0.11492;
mean
Torsten
le 22 Nov 2023
Modifié(e) : Torsten
le 22 Nov 2023
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.
Plus de réponses (1)
Torsten
le 21 Jan 2022
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 commentaires
Voir également
Catégories
En savoir plus sur Numbers and Precision dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!