% PROVEDENI NEKOLIKA ITERACI METODY BISEKCE PRO RESENI ROVNICE: x = f(x)
%
% Nastavte globalni promenne:
% I = [a,b] ... interval nezavisle promenne x
% f = 'f(x)'... analyticke vyjadreni funkce f(x) s nezavisle promennou x
% e =       ... predepsana presnost

format long
x=linspace(I(1),I(2)); plot(x,eval(f),x,zeros(size(x))); x=I; y=eval(f); k=2;
disp('         I(1)                 x                I(2)');
disp('   ------------------------------------------------');
while I(2)-I(1)>e & sign(y(k)),
   x=(I(1)+I(2))/2; yx=eval(f); [I(1),x,I(2)]
   k=1+(sign(yx)==sign(y(2))); I(k)=x; y(k)=yx;
   pause
end
