Mercurial > hg > ishara
diff general/numerical/divnorm.m @ 4:e44f49929e56
Adding reorganised general toolbox, now in several subdirectories.
author | samer |
---|---|
date | Sat, 12 Jan 2013 19:21:22 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/general/numerical/divnorm.m Sat Jan 12 19:21:22 2013 +0000 @@ -0,0 +1,15 @@ +function [Y,Z]=divnorm(F,X) +% divnorm - Do divisive normalisation of a sequence of vectors. +% +% divnorm :: +% ([[N,L]] -> [[1,L]]) ~'function to compute norm', +% [[N,L]] ~'array of L N-dim vectors' +% -> [[N,L]] ~'normalised vectors (ie unit 2-norm)', +% [[1,L]] ~'array of normalisation factors'. +% +% ie, if [Y,Z]=divnorm(X), +% then X = repmat(Z,size(X,1),1).*Y +% +% TODO: might like to smooth the envelope before dividing. +Y = vecop1(@rdivide,X,F(X)); +