Effacer les filtres
Effacer les filtres

Determining the coordinates of a node between two known nodes and knowing the distances between the known nodes

1 vue (au cours des 30 derniers jours)
Hi! This may seem like a rather trivial question. Do you know how to determine the coordinates of a node C knowing node A, node B, distance AC and distance CB?
At the moment I can use these two equations:
C = [x, y, z]; %unknown
A = [x_A, y_A, z_A];
d1 = (x-x_A)^2;
d2 = (y-y_A)^2;
d3 = (z-z_a)^2;
d_AC = sqrt(d1 + d2 + d3);
B = [x_B, y_B, z_B];
d4 = (x_B-x)^2;
d5 = (y_B-y)^2;
d6 = (z_B-z)^2;
d_CB = sqrt(d4 + d5 + d6);
A third equation is missing. At the moment I have no idea, and I don't know if it is possible to determine the coordinates directly on matlab.

Réponse acceptée

Matt J
Matt J le 13 Jan 2024
Modifié(e) : Matt J le 13 Jan 2024
Assuming the nodes form a straight line,
C = A + (B-A)*d_AC/(d_AC+dCB)
  1 commentaire
Torsten
Torsten le 13 Jan 2024
Assuming the nodes form a straight line
As said: this is a very special case, namely if dAC + dCB = dAB.

Connectez-vous pour commenter.

Plus de réponses (2)

Torsten
Torsten le 13 Jan 2024
There is only a unique solution for this problem if AC + CB = AB. In all other cases, you either get no solution (AC + CB < AB) or infinitly many solutions (AC + CB > AB).
  2 commentaires
Matt J
Matt J le 13 Jan 2024
Modifié(e) : Matt J le 13 Jan 2024
or infinitly many solutions (AC + CB > AB).
Wouldn't there be 2 solutions, assuming A~=B? The intersection of the circles of radii AC and BC?
Torsten
Torsten le 13 Jan 2024
Modifié(e) : Torsten le 13 Jan 2024
Not in 3d where spheres intersect. And this is reflected by having two equations for three unknowns.

Connectez-vous pour commenter.


Hassaan
Hassaan le 13 Jan 2024
function C = findPointC(A, B, d_AC, d_CB)
% Define the system of equations
function F = distanceEquations(C)
F(1) = (C(1) - A(1))^2 + (C(2) - A(2))^2 + (C(3) - A(3))^2 - d_AC^2;
F(2) = (C(1) - B(1))^2 + (C(2) - B(2))^2 + (C(3) - B(3))^2 - d_CB^2;
end
% Initial guess (can be changed based on the problem context)
initialGuess = (A + B) / 2;
% Solve the equations
C = fsolve(@distanceEquations, initialGuess, optimoptions('fsolve', 'Display', 'off'));
end
You can use this function by passing the coordinates of points A and B, and the distances dAC​ and dCB​. Keep in mind that this approach might find one of the possible solutions or may fail if the distances provided are not physically consistent with the positions of A and B.
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by