z=whitenoise(1:2847);
load cac40.m;
bas=cac40(1:2846);
di=diff(cac40);
dr=di(1:2846);
m=dr./bas;
m1=m(1:2845);
m2=m(2:2846);


e=diff(cac40);
a1=cac40(1:2846);
b1=cac40(2:2847);
a2=e(1:2845);
b2=e(2:2846);
c=z(1:2846);
d=z(2:2847);

b=3.999;
n=2847;
xinit=0.25;
x(1)=xinit;
time(1)=0;
for k=2:n+1;
time(k)=k-1;
x(k)=b*x(k-1)*(1-x(k-1));
end
x1=x(1:2846);
x2=x(2:2847);

whitebg
subplot(331);
plot(m,'b.','MarkerSize',5);
title('Stock index daily growth rate');
axis([0 2846 -0.1 0.1])

subplot(332);
plot(m1,m2,'b.','MarkerSize',5);
title('Poincaré Section');
xlabel('t');ylabel('t+1');grid;

subplot(333);
hyyt(m,100);
title('Histogram');
axis([-0.1 0.1 0 200]);grid

subplot(334);
plot(z,'b.','MarkerSize',5);
title('White Noise');
axis([0 2846 -4 4])

subplot(335);
plot(c,d,'b.','MarkerSize',5);
title('Poincaré Section');
xlabel('t');ylabel('t+1');axis([-4 4 -4 4]);grid;

subplot(336);
hyyt(z,100);
title('Histogram');
axis([-4 4 0 100]);grid

subplot(337);
plot(x,'b.','MarkerSize',5);
title('Logistic Eq. alpha=3.99');
axis([0 2846 0 1])

subplot(338);
plot(x1,x2,'b.','MarkerSize',5);
grid;title('Poincaré Section');
xlabel('t');ylabel('t+1') %axis([1 2845 0 1])

subplot(339);
hyyt(x,101);
title('Histogram');
axis([0 1 0 200]);grid;


% "Complex and Chaotic Nonlinear Dynamics. 
% Advances in Economics and Finance, 
% Mathematics and Statistics" 
% T.Vialar, Springer 2009.
% Copyright(c).