MATLAB Answers

Is there anyway to calculate the position in coordinates of points using a n*n distance matrix?

16 views (last 30 days)
Meme Young
Meme Young on 21 Jan 2021
Commented: Meme Young on 21 Jan 2021
if there are n points in a 2-D coordinate, it is relatively easy to calculate the distance matrix using their positions. However, can we calculate the position of n points using a n*n distance matrix? And, will there be more than one solution? Results with the same "shape" should be viewed as one solution.
Say, if there are only 3 points and a 3*3 distance matrix, it is very easy to obtain a triangle with only one possible shape. But if n > 3, will it also stand?

  0 Comments

Sign in to comment.

Answers (1)

David Goodmanson
David Goodmanson on 21 Jan 2021
Hi Meme,
first of all, if all you have are the distances between points, you can translate the all the points together in the 2d plane (two degrees of freedom), and you can rotate all of them together as well (one degree of freedom) without changing any distances. So there are three point coordinates that have to be defined from the start. Let's say that point 1 is taken to be at the origin by translation, and point 2 is taken to be somewhere to the right of point 1, on the x axis, by rotation. After that, you need to define 2*n-3 remaining point coordinates by using the distance matrix.
An nxn distance matrix is symmetric with zeros on the diagonal, so it has n(n-1)/2 independent elements. When n=3, there are 3 matrix elements to define 3 remaining point coordinates, so it works out exactly, as you have noted. But for n>=4. you have more distance conditions (6 for n=4) than coordinates, (5 for n=4) and the problem is overspecified. The distance matrix isn't arbitrary. It has to meet some conditions. The larger n is, the more overspecificaton there is. And the shape is uniquely defined.
Except that, if you flip the entire thing over, 180 degrees about the x axis, no initial point coordinates or distances change. That would, for example, turn an R shape into a backwards R shape, so you need to decide if that counts as different or not.

  1 Comment

Meme Young
Meme Young on 21 Jan 2021
Hi David,
You have proposed something very valuable. Is there any example code showing what you have said? It is a bit abstract and I cannot picture it in my head

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by