% Bisection method for a given function

% Enter a function
f = inline('x.^3+4*x.^2-10'); % notation .^3 and .^2 allows to compute f(x) if x is a vector

% Plotting our function
a = 1;
b = 2;
x = [a:0.1:b];
y = f(x);
plot(x,y, '-r','LineWidth', 2);
title('Function Plot');
xlabel('x');
ylabel('y = x^3+4*x^2-10');

format long;

% Call bisection routine
[root, num_iter] = bisect(f,a,b,10^-4)