Skip to content
Snippets Groups Projects
normalize.m 970 B
Newer Older
marwan's avatar
marwan committed
function y=normalize(x)
%NORMALIZE   Normalizes data series.
%   Y=NORMALIZE(X) normalizes the matrix X to zero-mean and
%   standard deviation one (Y=(X-mean(X))/std(X)).

marwan's avatar
marwan committed
% Norbert Marwan, Potsdam Institute for Climate Impact Research, Germany
% http://www.pik-potsdam.de
%
% Copyright (c) 1998-2008
marwan's avatar
marwan committed
% Norbert Marwan, Potsdam University, Germany
% http://www.agnld.uni-potsdam.de
%
% $Date$
% $Revision$
%
% $Log$
% Revision 2.2  2009/03/24 08:32:57  marwan
% copyright address changed
%
marwan's avatar
marwan committed
% Revision 2.1  2004/11/10 07:07:51  marwan
% initial import
%
marwan's avatar
marwan committed
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or any later version.


marwan's avatar
marwan committed
if min(size(x))==1
    y=(x-mean(x))/std(x);
else

  for i=1:size(x,2);
    y(:,i)=(x(:,i)-mean(x(:,i)))/std(x(:,i));
  end

end