MATLAB: How to find distance between two points

distance

Hai,
I need to find the distance between two points in the figure, which I have plotted. Is there any function in matlab that could find the distance between two points. Looking for your reply.
BSD

Best Answer

You can use the pdist function in the Statistics Toolbox:
e.g: distance between points (0,0) and (2,1)
>> X = [0,0;2,1];
>> d = pdist(X,'euclidean')
d =
2.2361