samer@4: function Y=vecshift(O,X) samer@4: % vecshift - refer an array of vectors to a new origin. samer@4: % samer@4: % This SUBTRACTS the first argument (a vector) from each samer@4: % of the vectors (row or column) in the second argument. samer@4: % Works in two modes: row vector or column vector mode. samer@4: % samer@4: % vecshift :: samer@4: % [[N,1]] ~'new origin', samer@4: % [[N,M]] ~'array of vectors, array domain is M' samer@4: % -> [[N,M]] ~'vectors relative to new origin'. samer@4: % samer@4: Y=X-repmat(O,1,size(X,2)); samer@4: