function x = nulaf(fs,a,b,eps)
f = sym(fs);
while abs(a-b)>eps
   m = (a+b)/2;
   if subs(f,'x',a)*subs(f,'x',m)<=0
      b = m; 
      %fprintf('b = %f',b);
   else
      a = m;
      %fprintf('a = %f',a);
   end
end
x = (a+b)/2;
end

%poziv za test primer
%nulaf('x^3+3*x^2+4',-1000,1000,0.00001)
