%Experiment, Chapter 6:  Transition to Chaos
%
%  This script records the asymptotic behavior of the orbit of 0 under the
%  quadratic map for 1000 values of c between -2 and 1/4.  
%
%  To find the asymptotic behavior, we iterate 500 times before recording
%  the orbit, then we'll record the next 200 points.  Altogether, we will
%  construct an array that is 1000 x 200.

N=10000;
A=zeros(N,200);
c=linspace(1,2,N)';
x=0.5;
for j=1:500
    x=c.*(x.*(x<= 1/2)+ (1-x).*(x>1/2));
end

%Now record and plot
for j=1:200
    A(:,j)=c.*(x.*(x<= 1/2)+ (1-x).*(x>1/2));
    x=A(:,j);
end
plot(c,A,'.', 'MarkerSize',1);
clear x j c