matlab distance between point and line code example Example: two point distance matlab >> x = [0 0]; >> y = [2 1]; >> norm(x-y) ans = 2.2361