Question #154   Submitted by Answiki on 09/17/2020 at 09:47:05 AM UTC

In MATLAB, how to compute the Euclidean distance between two points?

Answer   Submitted by Answiki on 09/17/2020 at 09:47:50 AM UTC

With MATLAB, the straightforward way to compute the distance between two points is to compute the norm of the vector defined by the two points. You can use the MATLAB norm(v) function that returns the Euclidean norm of vector v :

>> P1 = [1,2];
>> P2 = [2,4];
>> norm (P1 - P2)

ans =

    2.2361

This also works with 3D or even n-D points.

5 events in history
Answer by Answiki on 09/17/2020 at 09:47:50 AM

With MATLAB, the straightforward way to compute the distance between two points is to compute the norm of the vector defined by the two points. You can use the MATLAB norm(v) function that returns the Euclidean norm of vector v :

>> P1 = [1,2];
>> P2 = [2,4];
>> norm (P1 - P2)

ans =

    2.2361

This also works with 3D or even n-D points.

Answer by Answiki on 09/17/2020 at 09:47:45 AM

With MATLAB, the straightforward way to compute the distance between two points is to compute the norm of the vector defined by the two points. You can use the MATLAB norm(v) function that returns the Euclidean norm of vector v :

>> P1 = [1,2];
>> P2 = [2,4];
>> norm (P1 - P2)

ans =

    2.2361

This also works with 3D or even n-D points.


Question by Answiki 09/17/2020 at 09:47:05 AM
In MATLAB, how to compute the Euclidean distance between two points?
Answer by Answiki on 09/17/2020 at 09:46:24 AM

With MATLAB, the straightforward way to compute the distance between two points is to compute the norm of the vector defined by the two points. You can use the MATLAB norm(v) function that returns the Euclidean norm of vector v :

>> P1 = [1,2];
>> P2 = [2,4];
>> norm (P1 - P2)

ans =

    2.2361



Question by Answiki 09/17/2020 at 09:39:51 AM
With MATLAB, how to compute the distance between two points?
# ID Query URL Count

Icons proudly provided by Friconix.