function [An]=logistics_function(N,MaxIter)
  //----------------------------------------
  //
  // Bifurcation in the Logistics function
  // Xn+1 = rXn(1-Xn)
  //
  // Inputs:
  //        N - number of points of r to calculate
  //        MaxIter - number of interations
  //
  // Outputs:
  //        An - vector or length N
  //
  //
  //  Written: 8/2010
  //      David Adams Equails.com
  //      david.adams@equalis.com
  //----------------------------------------  
  
  [lhs,rhs]=argn(0);
  
  if(rhs == 0)
    N = 10000;
    MaxIter = 100;
  end
  
  r = linspace(0,4,N);
  An = rand(1,N);
  
  clf;
  a = gca();
  a.auto_clear = "on";
  
  for iter = 1:MaxIter
      An = r.*An.*(1-An);
      An = An.*((An<=1)&(An>=0)) + ((An<0)|(An>1)).*rand(1,N);
      
      plot(r,An,'r','linestyle','none','Marker','.','MarkerSize',0)
  end
  
endfunction

