% time-delay embedding demos. Barnett 11/12/15

load timeseries1
figure; plot(z,'.-'); title('raw data');     % not periodic, how predict?
figure; plot(z(1:end-1),z(2:end),'.'); title('R2 time-delay');
xlabel('z_n'); ylabel('z_{n+1}');
% Actually z_{n+1} given exactly by a single-valued function of z_n, easy!
% Fit the curve through points - can predict future z_n !
% Attractor is roughly uniform over [0.21, 0.94]
% Now reveal the source :)


load timeseries2
figure; plot(z,'.-'); title('raw data');
figure; plot(z(1:end-1),z(2:end),'.'); title('R2 time-delay');
xlabel('z_n'); ylabel('z_{n+1}');
% not single-valued func, not good for prediction!
% Solution: use 2 delays, plot in R3:
figure; plot3(z(1:end-2),z(2:end-1),z(3:end),'.'); axis equal vis3d
title('R3 time-delay'); xlabel('z_n'); ylabel('z_{n+1}'); zlabel('z_{n+2}');
% no longer self-intersects.
% Now reveal the source :)


load timeseries3
figure; plot(z,'.-'); title('raw data');
figure; plot(z(1:end-1),z(2:end),'.'); title('R2 time-delay');
xlabel('z_n'); ylabel('z_{n+1}');
% again, self-intersects
figure; plot3(z(1:end-2),z(2:end-1),z(3:end),'.','markersize',1);
axis equal vis3d
title('R3 time-delay'); xlabel('z_n'); ylabel('z_{n+1}'); zlabel('z_{n+2}');
% not self-intersects.
% (could do boxdim on attractor, a clue).
% Now reveal the source :)


load timeseries4
figure; plot(z,'.-'); title('raw data');
figure; plot3(z(1:end-2),z(2:end-1),z(3:end),'.','markersize',1);
axis equal vis3d
title('R3 time-delay'); xlabel('z_n'); ylabel('z_{n+1}'); zlabel('z_{n+2}');
% Note looks noisy.
% Now reveal the source :)

