function x0 = secantMethod(f,x0,varargin)
x0 = x0(:);
B = jacobian(f,x0, varargin{:});
fval = feval(f,x0, varargin{:});
for k=1:5
    s = -B\fval(:);
    x0 = x0 + s;
    fvalnew = feval(f,x0, varargin{:});
    y = fvalnew - fval;
    B = B + ((y - B*s)*(s'))./(s'*s);
    fval = fvalnew;
end