You are on page 1of 2

ALGORITMO DE MATLAB DE MÉTODOS NUMÉRICOS

function xm = biseccion(f,xi,xs,tol)

% tol-tolerancia--menor valor f(xm) estimado

if f(xi)*f(xs) < 0

xm=(xi+xs)/2;

err = abs(f(xm));

while abs(f(xm))>tol

if f(xi)*f(xm)< 0

xs=xm;

else

xi=xm;

end

xm=(xi+xs)/2;

err = abs(f(xm));

end

else

raiz='No hay cambio de signo'

end

You might also like