t=1;
iter=20;

u=zeros([1 iter]);
u(1)=0.96;
r=2.5;
u_s=0:.01:1;
plot(u_s,fun(u_s,r));
xlabel('N_t')
ylabel('N_{t+1}');
text(0.8, 0.4, 'N_{t+1}=f(N_t)')
text(0.8,0.7,'N_{t+1}=N_t');
line([0,1],[0,1]);

u(2)=fun(u(1),r);
line([u(1),u(1)],[0,u(2)],'Color',[1 0 0]);
line([u(1),u(2)],[u(2),u(2)],'Color',[1 0 0]);

for t=2:iter-1
   u(t+1)=fun(u(t),r);
   line([u(t),u(t)],[u(t),u(t+1)],'Color',[1 0 0]);
   line([u(t),u(t+1)],[u(t+1),u(t+1)],'Color',[1 0 0]);
   u2(t)=u(t+1);
   pause(0.5)
end

