フィルターのクリア

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

1 回表示 (過去 30 日間)
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.

採用された回答

Matt J
Matt J 2024 年 1 月 13 日
編集済み: Matt J 2024 年 1 月 13 日
Assuming the nodes form a straight line,
C = A + (B-A)*d_AC/(d_AC+dCB)
  1 件のコメント
Torsten
Torsten 2024 年 1 月 13 日
Assuming the nodes form a straight line
As said: this is a very special case, namely if dAC + dCB = dAB.

サインインしてコメントする。

その他の回答 (2 件)

Torsten
Torsten 2024 年 1 月 13 日
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 件のコメント
Matt J
Matt J 2024 年 1 月 13 日
編集済み: Matt J 2024 年 1 月 13 日
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 2024 年 1 月 13 日
編集済み: Torsten 2024 年 1 月 13 日
Not in 3d where spheres intersect. And this is reflected by having two equations for three unknowns.

サインインしてコメントする。


Hassaan
Hassaan 2024 年 1 月 13 日
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.

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by