MATLAB iteratively finds the root of the equation