% Compute the Lyapunov exponent of the % Logistic map for alpha=[2.4,4]. x0 = 0.5; alpha=[2.4:0.001:4]; OutLog = 200; % 100< - <300 OutLyap = 7000; % 500< - <10000 for i=1:size(alpha,2) x = x0; alpha(i); for j=1:OutLog x = alpha(i)*x*(1-x); end sum(i) = 0; for j=1:OutLyap x = alpha(i)*x*(1-x); sum(i) = sum(i) + log(abs(alpha(i)-2*alpha(i)*x)); end sum(i) = sum(i)/OutLyap; end LL=length(alpha); zero=zeros(1,LL); figure; text(2.6,.65,... texlabel('lambda>0: Chaotic')); hold on; text(2.6,.5,... texlabel('lambda(x_0)=(1/n) lim [ Sigma_0^(n-1)log|f^,(x_i)| ]')); hold on; text(2.6,-0.7,... texlabel('lambda<0: Deterministic ')); plot(alpha,sum,'b',alpha,zero,'r'); title('Lyapunov exponent of Logistic map'); xlabel(' 2.5 \leq \alpha \leq 4'); ylabel('Lce') axis([2.5 4 -1.2 0.8]); grid; % "Complex and Chaotic Nonlinear Dynamics. % Advances in Economics and Finance, % Mathematics and Statistics" % T.Vialar, Springer 2009. % Copyright(c).