view general/numerical/addnorm.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 source
function [Y,M]=addnorm(F,X)
% addnorm - additive normalisation with respect to arbitrary function
% 
% addnorm :: 
%    ([[N,M]] -> [[N,1]]) | ([[N,M]] -> [[1,M]]) 
%       ~'function to compute offsets',
%    [[N,M]]           ~'data to normalise'
% -> [[N,M]]           ~'offset vectors' 
%    [[N,1]] | [[1,M]] ~'the vector that was subtracted'.
%
% This function can work row-wise OR column-wise depending on what
% the offset computing function returns.
%
% EXAMPLES
% 
% To zero-mean each ROW of an N-by-M array X, use
%    addnorm(@(t)mean(t,2),X);
%
% To zero the MEDIAN of each COLUMN, use
%    addnorm(@median,X);

Y=vecop1(@minus,X,F(X)); % vecshift(F(X),X);