matlab: found indexing bug: should all like "if(all(r >= 1))"