function logistic_cobweb(r,N)
% m-file to test iterative maps: implements cobweb construction, including
% transients, for logistic map
%
yy = 0:0.05:1; ff = r.*yy.*(1-yy);
figure(1) ; clf ; 
plot(yy,ff,'-',yy,yy,'--')
hold on
x = 0.1;          % Initial value
Xn = [];
%r = 2;           % Bifurcation parameter
x1 = r*x*(1-x);
Xn = [Xn x1];
plot([x x],[0 x1],'r-',[x x1],[x1 x1],'r-')
x = x1;
for i = 2:N
    x1 = r*x*(1-x);
    Xn = [Xn x1];
    plot([x x],[x x1],'r-',[x x1],[x1 x1],'r-')
    x = x1;
end
hold off