reverse 3D euclidean distance
Show older comments
Hi there,
I am standing at an unknown point U(x,y,z) in the room. I can measure 3 (euclidean) distances D to 3 known points P in the room. I try to find the point, where I am at. My equation system looks like this:
(x-3)²+(y-1)²+(z-4)²=D1²=81
(x-12)²+(y-1)²+(z-4)²=D2²=36
(x-34)²+(y-2)²+(z-4)²=D3²=601
I can put the known points into a matrix P, the measured distance in a vector D:
P=[3 1 4;12 1 4; 34 2 4]
P =
3 1 4
12 1 4
34 2 4
D=[81 36 601]
Do you know how I can find U(x,y,z) ?
I am not sure if I can use
D = pdist(X,'euclidean');
Accepted Answer
More Answers (1)
Akira Agata
on 25 Jul 2019
There should be 2 answers.
Here is my try.
P = [3 1 4;12 1 4; 34 2 4];
D = [81 36 601];
func = @(x) (vecnorm(x - P(1,:))-sqrt(D(1)))^2+...
(vecnorm(x - P(2,:))-sqrt(D(2)))^2+...
(vecnorm(x - P(3,:))-sqrt(D(3)))^2;
x1 = fminsearch(func,[1 1 1]);
x2 = fminsearch(func,[10 10 10]);
>> x0
x0 =
10.0000 5.0000 -0.0000
>> x1
x1 =
10.0000 5.0000 8.0000
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!