function z = secanteger(x0,x1,tol,Nmax)
%SECANT METHOD: Enter f(x), x0, x1, tol, Nmax
f = @(x) x^3 + 4*x^2 - 10;
xn = x1 - f(x1)*(x1-x0)/(f(x1)-f(x0));
z=[xn]; i = 1;
while (abs(xn - x1) >= tol)
    x0 = x1;
    x1 = xn;
    xn = x1 - f(x1)*(x1-x0)/(f(x1)-f(x0));
    z=[z,xn];
    i = i + 1;
    if (i >= Nmax)
        fprintf('Fail after %d iterations\n',Nmax);
        break
    end
end
end

