function [i,x,fx]=matlab1(f,bot,top,err)
if f(bot)*f(top)>0
disp('');
return
end
i=ceil((log(top-bot)- log(err))/log(2))-1;
while abs(top-bot)>err
x=(bot+top)/2;
fx=f(x);
if fx==0
bot=x; top=x;
elseif f(bot)*fx<0
top=x;
else
bot=x;
end
end