function newX = boundaries(x)
    
global maxD;
newX = x;
if x > maxD
    newX = maxD;
end

if x<1
    newX = 1;
end