samer@4: function [Y,Z]=divnorm(F,X) samer@4: % divnorm - Do divisive normalisation of a sequence of vectors. samer@4: % samer@4: % divnorm :: samer@4: % ([[N,L]] -> [[1,L]]) ~'function to compute norm', samer@4: % [[N,L]] ~'array of L N-dim vectors' samer@4: % -> [[N,L]] ~'normalised vectors (ie unit 2-norm)', samer@4: % [[1,L]] ~'array of normalisation factors'. samer@4: % samer@4: % ie, if [Y,Z]=divnorm(X), samer@4: % then X = repmat(Z,size(X,1),1).*Y samer@4: % samer@4: % TODO: might like to smooth the envelope before dividing. samer@4: Y = vecop1(@rdivide,X,F(X)); samer@4: