clear all;
close all;

Niterates   = 3000;
Nlambda     = 300;
Ntransients = 100;

%  ---------  Initial Conditions  ---------
lambda_min = 1.0;
lambda_max = 4.0;
xmin       = 0.0;
xmax       = 1.0;

for k=1:Nlambda
  lambda = lambda_min + (lambda_max-lambda_min)*(k-1)/(Nlambda-1);

  %  ---------  Transients  ---------
  x0 = 0.1237;
  for i=1:Ntransients
    x1 = lambda*x0*(1.0-x0);
    x0 = x1;
  end;
  
  %  ---------  Iterate  ---------
  for j=1:Niterates
    x1     = lambda*x0*(1.0-x0);
    x0     = x1;
    t(j,k) = lambda;
    v(j,k) = x1;
  end;
end;

plot(t,v,'.','Markersize',4);
xlabel('{\lambda}');
ylabel('{x_n}');
axis([lambda_min lambda_max xmin xmax]);
