clear all;

phi=inline('x-(x^3 + 4*x^2 -10)/(3*x^2+8*x)','x');

phip=vectorize(phi);
xp=linspace(1,2,100);
yp=phip(xp);
plot(xp, yp)

tol=1e-9;

x(1)=1.5;
x(2)=phi(x(1));
k=2;
while abs( x(k) - x(k-1) ) > tol
    k=k+1;
    if k>100
        break
    end
    x(k)=phi( x(k-1) );
end

format long g
x.'
