clear; n=1; %counter for each value of "r" R=[3:0.005:4]; %range of values for parameter R. f = inline('r*x*(1-x) ','x','r'); %definition of map %%%%%%%%%% dont edit below this line! for r=R, %loop over all elements of R %%%%% first converge to attractor x = rand; %choose random initial data for i=1:200; x = f(x,r); end; %%%%% now collect points on attractor into "data matrix" for i=1:200; x = f(x,r); %logistic map data(i,n) = x; end; n=n+1; end; plot(R,data', '.b'); xlabel('r'); ylabel('x'); zoom on;