clear;
min_mu = 2.8;
max_mu = 4;
max_count = 400;

for j=1:max_count
    if (j == 1)
        z(j, 1) = 0.65;
    else
        z(j, 1) = z(j-1, max_count);
    end
    mu(j) = ((max_count-j-1) / (max_count-1))*(max_mu - min_mu) + min_mu;
    
    avg(j) = z(j, 1);
    for i=1:max_count
        z(j, i+1) = mu(j)*z(j, i)*(1-z(j, i));
        avg(j) = avg(j) + z(j, i+1);
    end
    avg(j) = avg(j) / max_count;
end

bins = 100;

r = 0.99;
y(1) = 1;
for j = 1:max_count
    y(j+1) = r * y(j);
    for i=1:max_count
        x(j,i) = y(j) * z(1,i);
    end    
end
