for alpha=3.5:0.0005:4;
xinit=0.56;
n=100;

[time,x]=logis(alpha,xinit,n);

% function [time,x]=logis(alpha,xinit,n) 
% is equivalent to:
%
% x(1)=xinit;
% time(1)=0;
% for k=2:n+1;
% time(k)=k-1;
% x(k)=alpha*x(k-1)*(1-x(k-1));
% end
%

pause(0.0000000001)

plot(x);
title('Behavior of logistic map, \alpha = 3.5, ..., 4 ');
xlabel(['\alpha: ', num2str(alpha)]);
ylabel('Output X')
axis([1 100 0 1]);
end

%"Complex and Chaotic Nonlinear Dynamics. 
% Advances in Economics and Finance, 
% Mathematics and Statistics" 
% T.Vialar, Springer 2009.
% Copyright(c)