format compact format long xl = 0; xr = 5; for i=1:200 xm = (xl + xr)/2; if ( xl^2 - 2 )*( xm^2 - 2 ) < 0 xr = xm; else xl = xm; end xm end