Finding distance between two points from 3D coordinates?

234 views (last 30 days)
If I have two points in 3d, A = [1579.4 51.2 279]
B = [1674.4 86.7 249]
these are (x, y, z) coordinates in mm, What is the easiest way to compute the distance (mm) between these two points in matlab,
Thanks.

Answers (2)

Jan
Jan on 6 Feb 2018
Edited: Jan on 15 Feb 2018
sqrt(sum((A - B) .^ 2))
or:
norm(A - B)

Muhammd
Muhammd on 14 Mar 2023
P1=[x,y,z] P2=[x1,y1,z1] D=norm(P1-P2)

Categories

Find more on Operators and Elementary Operations 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!