function [x,nit,xv,flag]=secanti(fun,x0,x)
nmax=1000;
toll=1.e-12;
flag=1;
xv=[x0,x];
fx0=feval(fun,x0);
for nit=1:nmax
    fx=feval(fun,x);
    inc=(x0-x)/(fx0-fx)*fx;
    x0=x; 
    fx0=fx;
    x=x-inc;
    xv=[xv,x];
    if abs(inc)<toll, flag=0; return, end
end
