I think `hMax2 = sum(obj.basisvector,2);` can be replaced with `hMax2 = abs(sum(obj.basisvector,2));` to solve this problem.