function logistic_cobweb2(r,N,N0)
% m-file to test iterative maps: implements cobweb construction,
% eliminating transients
%
yy = 0:0.05:1; ff = r.*yy.*(1-yy);
figure(1) ; clf ;
plot(yy,ff,'-',yy,yy,'--')
hold on
Xn = [];
x = 0.3;          % Initial value
Xn = [];
%r = 2;           % Bifurcation parameter
for i = 1:N0      % Eliminate transients - first N0 steps
    x1 = r*x*(1-x);
    x = x1;
end
%plot([x x],[0 x],'r-')  % First line, to get to diagonal
for i = 1:N
    x1 = r*x*(1-x);
    Xn = [Xn x1];
    plot([x x],[x x1],'r-',[x x1],[x1 x1],'r-')
    x = x1;
end
axis([0 1 0 1])
hold off