function v = clip(x,l,u)
  v = x;
  if ( x<l )
    v = l;
  end
  if x > u
    v = u;
  end
