function iter2x(f,x0,N)
% m-file to test iterative maps: implements cobweb construction, including
% transients, for general map without parameter; the initial condition x0
% is specified; see iter1x.m for usage
%
if x0 < 1
  yy= 0:0.02:1;
else
    yy = 0:0.02:(x0+0.2);
end
figure(1) ; clf ; 
plot(yy,feval(f,yy),'-',yy,yy,'--')
hold on
x = x0;          % Initial value
Xn = [];
%r = 2;           % Bifurcation parameter
plot([x x],[0 x],'r-')  % First line, to get to diagonal
for i = 1:N
    x1 = feval(f,x);
    Xn = [Xn x1];
    plot([x x],[x x1],'r-',[x x1],[x1 x1],'r-')
    x = x1;
end
hold off