function y=validate(x,C0,C1)

% verify box-constraints and change them if it is necessary (y must belong to X)

indl = x<C0; indh = x>C1;

y=x; 
y(indl)=C0(indl);
y(indh)=C1(indh);


%len_par = length(par);
%len_y = length(y);
%step = (par(2) -  par(1))/2;

%for i=1:len_par
%    if x(len_y) >= par(i) - step &  x(len_y) <= par(i) + step
%        y(len_y) = par(i); % new value
%    end    
%end
