annotate general/numerical/vecshift.m @ 4:e44f49929e56
Adding reorganised general toolbox, now in several subdirectories.
author |
samer |
date |
Sat, 12 Jan 2013 19:21:22 +0000 |
parents |
|
children |
|
rev |
line source |
samer@4
|
1 function Y=vecshift(O,X)
|
samer@4
|
2 % vecshift - refer an array of vectors to a new origin.
|
samer@4
|
3 %
|
samer@4
|
4 % This SUBTRACTS the first argument (a vector) from each
|
samer@4
|
5 % of the vectors (row or column) in the second argument.
|
samer@4
|
6 % Works in two modes: row vector or column vector mode.
|
samer@4
|
7 %
|
samer@4
|
8 % vecshift ::
|
samer@4
|
9 % [[N,1]] ~'new origin',
|
samer@4
|
10 % [[N,M]] ~'array of vectors, array domain is M'
|
samer@4
|
11 % -> [[N,M]] ~'vectors relative to new origin'.
|
samer@4
|
12 %
|
samer@4
|
13
|
samer@4
|
14 % note: this now works for any pair of arrays where size O
|
samer@4
|
15 % is an integer fraction of size X in any dimension
|
samer@4
|
16 Y=X-repmat(O,1,size(X,2));
|
samer@4
|
17
|