Matlab Function find sum of Euclidean distances from a given 2-D point
Show older comments
Can someone help me with the following question?
Create a Matlab function to find the sum of straight-line (Euclidean) distances from a given 2-D point x to the set S of k other 2-D points.
For example:
Test
x=[2 4];
S=[2 6; 2 -1; 3 3];
2 Comments
KSSV
on 27 Oct 2020
What have you attempted for this simple question?
Liam Bouchereau
on 27 Oct 2020
Answers (1)
Sudhakar Shinde
on 27 Oct 2020
Use docsearch 'Euclidean'.
Use norm to calculate the distance between the points(a & b ).
%Example:
d = norm(b-a)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!