%Example: If x_0=0.1 and f(x)=3.2x(1-x), then there is an attracting %period-2 point. Find them, and verify that the appropriate derivative at %those points are less than 1 in magnitude: f=inline('3.2*x.*(1-x)'); df=inline('3.2*(1-2*x)'); d2f=inline('(3.2^2).*(1-2*x).*(2*3.2*x.^2-2*3.2*x+1)'); x=0.1; %Run the iterations through to get to the period-2 point first: for j=1:100 y=f(x); x=y; end for j=1:100 orbit(j)=f(x); x=orbit(j); end orbit(98)-orbit(100) d2f(orbit(99:100)) df(orbit(99:100)) df(orbit(99))*df(orbit(100))