xim1 = 3.5;
xi = 1.5;
iterace = 0;
epsilon = abs(xim1-xi);

while epsilon>1e-6,
    xip1 = (funkce(xi)*xim1-funkce(xim1)*xi)/(funkce(xi)-funkce(xim1));
    xim1 = xi;
    xi = xip1;
    epsilon = abs(xim1-xi);
    reseni = xi;
    iterace = iterace +1;
    [iterace reseni epsilon]
end