view general/numerical/vecshift.m @ 6:0ce3c2070089

Removed duplicate code and fixed doc in timed_action.
author samer
date Mon, 14 Jan 2013 14:33:37 +0000
parents e44f49929e56
children
line wrap: on
line source
function Y=vecshift(O,X)
% vecshift - refer an array of vectors to a new origin.
%
% This SUBTRACTS the first argument (a vector) from each
% of the vectors (row or column) in the second argument.
% Works in two modes: row vector or column vector mode.
%
% vecshift :: 
%    [[N,1]] ~'new origin', 
%    [[N,M]] ~'array of vectors, array domain is M'
% -> [[N,M]] ~'vectors relative to new origin'.
%

% note: this now works for any pair of arrays where size O
% is an integer fraction of size X in any dimension
Y=X-repmat(O,1,size(X,2));