function len=llength(x,y) %LLENGTH Length of a line. % % LLENGTH(X,Y) return the length of the line % described by X and Y. % The length is calculated as the sum of the % distances between two consecutive points. % % Claudio 6 September 1994. % % % Copyright (c) 1995 by Claudio Rivetti and Mark Young % claudio@alice.uoregon.edu, mark@alice.uoregon.edu % n=length(x); if n ~= length(y) error('Vectors must be the same lengths.') end xi = x(1:n-1); xii = x(2:n); yi = y(1:n-1); yii = y(2:n); len = sum(sqrt((xi-xii).^2 + (yi-yii).^2)); return;