% Plot the two functions f & g figure f = inline('x.^3 + 4*x.^2 - 10'); x=0.5:0.01:5; plot(x,f(x)), grid on figure g= inline('sqrt(10-x.^3)/2'); x=0.5:0.01:5; plot(x,g(x),x,x), grid on %-------------------------- a=1; b=2; x0 =1.5; x1 = g(x0); iterMax=10; if ((f(a)*f(b))< 0) for iter=1:iterMax x0=x1; x1 = g(x0); fprintf('For iteration =%d \t , the solution is x0=%f\n',iter,x0) end fprintf('The final solution is x0 = %f \n',x0) ; else disp('There is no solution in [a,b]') end