function x_norm=norm_x(x,cod)
%Íîðìèðîâêà âåêòîðà
%Èñïîëüçîâàíèå: x_norm=norm_x(x,code)
%     x - âõîäíîé âåêòîð
%  code - îïðåäåë?åò íîðìèðîâêó:
%         'mm' - âûõîäíîé âåêòîð èçìåí?åòñ? â ïðåäåëàõ
%                îò -1 äî +1;
%         'sd' - âûõîäíîé âåêòîð = (x-mean(x))/std(x);
%         ïî óìîë÷àíèþ = 'sd'

%  Õîìóòîâ Ñ.Þ.
%  04.04.96
%
if nargin==1
   cod='sd';
end
if cod=='mm'
     x_max=max(x);
     x_min=min(x);
     shift=(x_max+x_min)/2;
     scale=(x_max-x_min)/2;
     x_norm=(x-shift)./scale;
else
     x_norm=(x-mean(x))./std(x);
end
