% Distribution wit different sample sizes



nsample = [100 1000 10000];    % Size of the sample



for k = 1:3

    n = nsample(k);

    S = zeros(1,n);

    S(1,1) = rand;

    for j = 2:n

        S(j) = 4*S(j-1)*(1-S(j-1));

    end



    % Plotting



    figure(k)

    plot(S,'k-')

    axis([1 n -0.5,1.5])

    title(['Sample size =' num2str(n)])

    % Plotting the histogram



    figure(3+k)

    hist(S,30)

    title(['Sample size =' num2str(n)])

    pause

end
