Borrar filtros
Borrar filtros

how world i find the lowest root with bisection

4 visualizaciones (últimos 30 días)
adriana resendez
adriana resendez el 3 de Mzo. de 2015
Respondida: rantunes el 3 de Mzo. de 2015
function [xr ea iter] = bisect(func, x1, xu, es, maxit)
% function [xr ea iter] = bisect(func, x1, xu, es, maxit)
% bisection method
if func(x1)*func(xu)>=0, error('no sign change'); end
xold = x1;
for iter = 1:maxit
xr = (xL+xU)
xr2 = roots([1 0 -3 -1]);
test = func(xL)*func(xr);
ea = abs((xr-xold)/xr)*100;
if test<0,xU = xr;
elseif test>0, xL = xr;
else ea = 0;
end
if ea<=es, break; end
xold = xr;
end
end

Respuestas (1)

rantunes
rantunes el 3 de Mzo. de 2015
Hey,
You have to be more specific. I suspect your code doesn't even run due to non-coherent syntax.
What do you want to do? Compute the root of a function using the bisection method?
Greets

Categorías

Más información sobre Testing Frameworks en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by