function ex05a()
% Lösung von Aufgabe 5a
f = @(x) sin(1./x);
a = 0.107; 
b = 0.28;  
epsRel = 1e-5;

x = 0.1:0.0001:0.3;
y = f(x);
set(0,"defaultfigurecolor","white");
plot(x, y, "b-", x, 0*x, "k-", [a b], f([a b]), "k*")
hold("on")

error = Inf;
while (error > epsRel)
  [a, b] = bisektionsSchritt(f, a, b);
  fprintf("[%8.6f %8.6f]\n", a, b);
  xm = (a + b)/2;
  plot(xm, f(xm), "r*")
  error = 0.5*abs(b-a)/abs(xm);
end
hold("off")

F = getframe(gcf);
imwrite(F.cdata, "bild81.png");
