%% Euclidean Distance Between Two Points
% Calculate the distance between two points as the norm of the difference between the vector elements.
%
% Create two vectors representing the (x,y) coordinates for two points on the Euclidean plane.

a = [0 3];
b = [-2 1];

%
%  Use norm to calculate the distance between the points.

d = norm(b-a)

%
% Geometrically, the distance between the points is equal to the magnitude of the vector that extends from one point to the other.
% a = 0\hat{i} + 3\hat{j}\\
% b = -2\hat{i} + 1\hat{j}\\
% \\
% \begin{array}{rl}
% d_{(a,b)} &= ||b-a|| \\
% &= \sqrt{(-2-0)^2 + (1-3)^2} \\
% &= \sqrt{8}
% \end{array}
% Copyright 2012 The MathWorks, Inc.