% final answer accuracy is enough for %variable introduction % X1 is the left point % X2 is the right point % X3 is the average value, otherwise X3=(X1+X2)/2 % value takes the value of function when X3 substitute it in the function % previousX1Value takes the value of function when X1 substitute it in the function % nextX2Value takes the value of function when X2 substitute it in the function format long; syms x; sym value; f(x) = x^2 -4*x -13; X1 = -2.2; X2 = -2.1; n=1; while n<50 X3 = (X1 + X2)/2; value = f(X3); previousX1Value = f(X1); nextX2Value = f(X2); if ( value * previousX1Value )<0 X2 = X3; else X1 = X3; end if value <0 value = -1*value; end %programe displays all solutions which are smaller than 0.000000000001 if value<0.000000000001 disp(double(X3)); end n=n+1; end %end of while clear all;