% logistics map - Strogatz % Math 553 - DeLillo, Fall 2011 N = 40; % number of iterations xn(1:N)=zeros(1,N); % initialize interation vector xc(1:2*(N-1))= zeros(1,2*(N-1)); % initialize vector for cobweb plot xn(1)=.9; % initial guess r = 3.449; % fix value of r for n=1:N-1 xn(n+1) = r*xn(n)*(1-xn(n)); end % Plot output figure(1) % time series generated by f = r*x*(1-x) plot(1:N,xn,'-o') figure(2); % plot of map f from time series plot(xn(1:N-1),xn(2:N),'o'); axis([0 1 0 1]); figure(3); % cobweb plot xc(1:2:2*(N-1))=xn(1:N-1); xc(2:2:2*(N-1))=xn(1:N-1); xc2(1:2:2*(N-1)-1)=xn(1:N-1); xc2(2:2:2*(N-1))=xn(2:N); xp=(0:100)/100; plot(xc,xc2,'-o',xp,r*xp.*(1-xp),xp,xp)