function logistic(r,s,w,t,lst); %(r parameter,start x,how many transients to ignore,no of iterations, list values=1 no=0) % note r=3+65/90+.018 period 5 r=3+65/90+.02 period 10 clf; steps=t; res=200; xi=zeros(1,steps); xi(1)=s; for i=2:steps xi(i)=myfn(r,xi(i-1)); end hold on x=linspace(0,1,res); y=myfn(r,x); plot(x,y); y=x; plot(x,y); x=zeros(2*steps-2); y=x; for i=w:steps-1 y(2*i-1)=xi(i+1); y(2*i)=xi(i+1); x(2*i-1)=xi(i); x(2*i)=xi(i+1); end line(x(2*w-1:2*steps-2),y(2*w-1:2*steps-2)); hold off if lst for i=w:steps fprintf('%2.2f \n',xi(i)); end end function myval=myfn(r,x) myval=r.*x.*(1-x);