function [x,nitr]=bisecton(f,a,b,d)
%fÊÇ´ýÇ󷽳̵ľä±ú
%a£¬b·Ö±ðÊÇÇó½âÇø¼äµÄÉÏÏÞºÍÏÂÏÞ
%dÊǾ«¶È¿ØÖÆ
%Ö»ÄÜÇ󵥸ù£¬Èç¹ûÓжà¸ùµÄ»°£¬±ØÐë·Ö³É¶à¸öÇø¼äÇó½â
format long
fa=sign(f(a));
fb=sign(f(b));
nitr=0;
if fa==0
x=a;
return;
elseif fb==0
x=b;
return
elseif fa*fb>0
error('No root in this interval')
end
while b-a>d
c=0.5*(a+b);
fc=f(c);
if fc==0
x=c;
return;
elseif sign(fa)*sign(fc)