x0=0.7; a=4; n=100; f = @(x) a.*x.*(1-x); x=[x0,x0]; pert=0.000001; xx=[x0+pert,x0+pert]; for k=1:n x=[x,f(x(end)),f(x(end))]; xx=[xx,f(xx(end)),f(xx(end))]; end; figure(1) plot(1:n+1,x(2*(1:n+1)),'r-',1:n+1,xx(2*(1:n+1)),'b-',1:n+1,(sin(2.^(0:n).*asin(sqrt(x0)))).^2,'g-') figure(2) axis equal plot(x,x,'g-',x(1:2*n+1),[0,x(3:2*(n+1))],'r-',xx(1:2*n+1),[0,xx(3:2*(n+1))],'b-',[0:0.01:1],f(0:0.01:1))