Logistic Map Demonstration
Cobweb plots
Simulate the logistic map for 20 steps with parameter . Plot the result as a cobweb. (Note the use of an anonymous function). x=cobweb(f,[0 1],x0,N,pauseFlag);
Change the initial condition slightly to show that the trajectories eventually diverge.
xx=iterateMap(f,x1,N);cobwebLine(xx);
Now plot the two time series as functions of discrete time to see how they diverge exponentially.
xlabel('$n$');ylabel('$x_n$')
semilogy(0:N,abs(x-xx),'b-o')
xlabel('$n$');ylabel('$|\Delta x_n|$')
Bifurcation diagram
Vary the parameter r. For each value of r, simulate for N steps. Discard the first nTransient iterates and record the rest. See a crude period-doubling diagram. Compute the Liapunov exponent, which will be used in the next plot.
nr=201; dr=(rMax-rMin)/nr;
liapunovExp=zeros(nr+1,1);
fprime=@(x)logisticMapPrime(x,r);
plot(r*ones(N-nTransient),x(nTransient+1:N),'.','color','b')
liapunovExp(k+1)=liapunov1D(fprime,x);
xlabel('$r$');ylabel('$x$')
Plot the Liapunov exponent
plot(linspace(rMin,rMax,nr+1),liapunovExp)
xlabel('$r$');ylabel('$\lambda$')
Universality
Strogatz tells us that for any map of the form , where is unimodal with a quadratic maximum, then the period doubling diagram will look essentially the same. (See the book for the technical details of this statement.) Here we reproduce the last two figures with the map Bifurcation diagram
Vary the parameter r. For each value of r, simulate for N steps. Discard the first nTransient iterates and record the rest. See a crude period-doubling diagram. Compute the Liapunov exponent, which will be used in the next plot.
nr=201; dr=(rMax-rMin)/nr;
liapunovExp=zeros(nr+1,1);
fprime=@(x)sineMapPrime(x,r);
plot(r*ones(N-nTransient),x(nTransient+1:N),'.','color','b')
liapunovExp(k+1)=liapunov1D(fprime,x);
xlabel('$r$');ylabel('$x$')
Plot the Liapunov exponent
plot(linspace(rMin,rMax,nr+1),liapunovExp)
xlabel('$r$');ylabel('$\lambda$')
Plot the nth-iterate of a map
The logistic map has period 3 windows for f=@(x)logisticMap(x,3.835);
plotNthIterate(f,3,[0 1])
Functions called
function y = logisticMap(x,r)
function y = logisticMapPrime(x,r)
function y=sineMapPrime(x,r)