ANOMALY

calculates normalization of z,s
 The matrix z are normalized according to "opt"
       ----   Mean is subtracted and divided by the standard
       'full'   Mean is subtracted and divided by the standard
       'anom' Only Mean is subtracted
       'one'  Column of the matrix are normalized to unit 2-norm
               [zn,sn,norm(z),norm(s)]=anomnorm(z,s,'one'norm)
        [zn,SZ]=anomaly(z,'full')
function [zn,SZ]=anomaly(z,opt)
%  Normalize Matrices
%
if nargin < 2
    default=1; disp('Normalization full')
end
if nargin == 2
    if strcmp(opt,'full')
        default=1 ; disp(['Normalization ' opt])
    end
    if strcmp(opt,'anom')
        default=2; disp(['Normalization ' opt])
    end
    if strcmp(opt,'none')
        disp([' No Normalization ' opt])
        zn=z;SZ=1; return;
    end
    if strcmp(opt,'one')
        sz=size(z);
        MZ=mean(z')';

        for ii=1:sz(2)
            zn(:,ii) = (z(:,ii) - MZ(:) );
        end


        for i=1:sz(2)
            nmz(i) = norm(zn(:,i));
        end


        for i=1:sz(2)
            zn(:,i)=zn(:,i)/nmz(i);
        end

        SZ=nmz;
        return
    end
end
MZ=mean(z')';

if default == 1
    SZ=std(z')';

end
if default == 2
    SZ=ones(size(MZ));

end
sizz=size(z);

for ii=1:sizz(2)
    zn(:,ii) = (z(:,ii) - MZ(:) ) ./SZ(:);
end

return