f = inline('x.^3 + 4*x.^2 - 10'); %-------------------------- fp=inline('3*x.^2 + 8.*x'); a=1; b=2; x0 =1.5; x1 = x0-(f(x0)/fp(x0)); iterMax=10; if ((f(a)*f(b))< 0) for iter=1:iterMax x0=x1; x1 = x0-(f(x0)/fp(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