function fixed_point()
close all
a = .95;
tol = 10^(-8);
imax = 1000;
i = 1;
x(1) = .01;
deltax = 1;
%for i = 1:imax
while deltax >= tol & i <= imax
y(i) = f1(x(i),a);
x(i+1) = y(i);
deltax = abs(y(i)-x(i));
i = i+1;
end
n = length(y)
for i = 1:n-1
xv=x(i)*ones(1,20);
yv=linspace(x(i),x(i+1),20);
yh=x(i+1)*ones(1,20);
hold on
plot(x(i),x(i+1),'ro',...
xv,yv,'g',yv,yh,'g')
end
xx = linspace(0,1,100);
yy = f1(xx,a);
hold on
plot(xx,xx,'g',xx,yy,'b')

function y = f1(x,a)
y = 4*a*x.*(1-x);