function [x] = checkrange(x,a,b);
%function [x] = checkrange(x,a,b);
%checks the range-must be within [a,b];

if(nargin == 1), a=eps; b=1-eps;end
indxa = find(x<a);Nindxa = length(indxa);
indxb = find(x>b);Nindxb = length(indxb);

if(Nindxa >= 1);x(indxa) = a;end
if(Nindxb >= 1);x(indxb) = b;end
