%
% Script file: fixpoint.m
%
x=3.2;  delta=1.0;  tol=0.00001;
Nrun=30; num=0;
while (++num < Nrun && delta>tol)
  y=(x*x-4)/3;
  delta=abs(x-y);
  x=y;
end
x
X=-2:0.5:5;
Y=X;
F=(X.*X-4)/3;
plot(X,F,'b-',X,Y,'r-'); axis([-2, 5, -2, 5]);
legend('F(x)=(x^2-4)/3','Y=X','Location','Northwest');
text(-1,-1,'O');
text(4,4,'X');
title('Demo of a fixed point application') 