% this the the matlab file associated with the results gotten from 
% /cavs/hse/ies/d002/isip/users/patil/research/nonlinear/programs/Lyapunov/lyapunov_00.cc
% the four files which stored the data are
% doubleFileY.txt  floatFileX.txt  
% doubleFileX.txt  floatFileY.txt
% The data is stored in four files so that it becomes easy to handle the
% data (copy paste) the data from these files into matlab
%

% ========================================================================
%
% The matlab code for Chaos Theory - 
%                 Nonlinear Statistical Modeling of Speech
% date : July 15, 2005 Friday.
% IES: http://www.cavs.msstate.edu/hse/ies/projects/nsf_nonlinear
%
% ========================================================================
% setting up the environment
%
close all;
clc;
clear all;

% the float data
% the data has to be entered on a same line, as Matlab treats data coming
% on different line as a different row data
% hence causing trouble with the plots
% 
x1 = [ 0 1.4 -0.56 1.1284 0.109913  1.42177 -0.618136   1.06056 0.256665  1.36594 -0.458092 1.23113 -0.129424 1.42018 -0.620804 1.05721 0.263687 1.36219  -0.447639 1.24048 -0.152231 1.41404 -0.604077 1.07751 0.220844 1.38355 -0.507594 1.18385 -0.0167403 1.43524 -0.660403 1.00693 0.36629 1.29604 -0.26873 1.36667 -0.475836 1.21458 -0.0894789 1.42843 -0.643099 1.02928 0.321297 1.32765 -0.353006 1.31522 -0.340384 1.32359 -0.362115 1.30858 -0.323246 1.33477 -0.391306 1.28692 -0.267909 1.36683 -0.476268 1.21417 -0.088506 1.42859 -0.64353 1.02873 0.322415 1.32691 -0.351019 1.31659 -0.343948 1.3212 -0.355882 1.31298 -0.334603 1.32743 -0.37211 1.30136 -0.304694 1.3462 -0.421401 1.26281 -0.207324 1.3949 -0.551969 1.13718 0.0902686 1.42597 -0.630673 1.04503 0.288992 1.34783 -0.407988 1.27398 -0.235266 1.38287 -0.519385 1.17172 0.0114792 1.43502 -0.658938 1.00885 0.362451 1.2989]; 
y1 = [ 0 0     1.4 -0.56    1.1284 0.109913   1.42177 -0.618136 1.06056  0.256665  1.36594 -0.458092 1.23113 -0.129424 1.42018 -0.620804 1.05721 0.263687 1.36219 -0.447639 1.24048 -0.152231 1.41404 -0.604077 1.07751  0.220844  1.38355 -0.507594 1.18385 -0.0167403 1.43524 -0.660403 1.00693 0.36629 1.29604 -0.26873 1.36667 -0.475836 1.21458 -0.0894789 1.42843 -0.643099 1.02928 0.321297 1.32765 -0.353006 1.31522 -0.340384 1.32359 -0.362115 1.30858 -0.323246 1.33477 -0.391306 1.28692 -0.267909 1.36683 -0.476268 1.21417 -0.088506 1.42859 -0.64353 1.02873  0.322415 1.32691 -0.351019 1.31659 -0.343948 1.3212 -0.355882 1.31298 -0.334603 1.32743 -0.37211 1.30136  -0.304694 1.3462 -0.421401 1.26281 -0.207324 1.3949 -0.551969 1.13718 0.0902686 1.42597 -0.630673 1.04503 0.288992 1.34783 -0.407988 1.27398 -0.235266 1.38287 -0.519385 1.17172 0.0114792 1.43502 -0.658938 1.00885 0.362451]; 

% the double data
%
x2 = [ 0 1.4 -0.56 1.1284 0.109913 1.42177 -0.618135 1.06056 0.256665 1.36594 -0.458092 1.23113 -0.129423 1.42018 -0.620804 1.05721 0.263687 1.36219 -0.447639 1.24049 -0.152232 1.41404 -0.604076 1.07751 0.220842 1.38355 -0.507598 1.18385 -0.0167321  1.43524 -0.660403 1.00692 0.36629 1.29604 -0.268729 1.36667 -0.475838 1.21458 -0.0894749 1.42843 -0.643101 1.02927 0.321302 1.32764 -0.352998 1.31522 -0.340399 1.32359 -0.36209 1.3086 -0.323292 1.33474 -0.39123 1.28698 -0.268058 1.36675 -0.47606 1.21437 -0.0889759 1.42851 -0.643323 1.02899 0.321877 1.32726 -0.351976 1.31593 -0.342233 1.32235 -0.358888 1.31087 -0.329147 1.33099 -0.381405 1.29446 -0.287069 1.35643 -0.448501 1.23954 -0.149913 1.41471 -0.605908 1.07532 0.225516 1.3814 -0.501506 1.18993 -0.0309872 1.43474 -0.659402 1.00823 0.363688 1.29798 -0.273835 1.36395 -0.468584 1.22135 -0.105747 1.42546 -0.635103 1.03941]; 
y2 = [ 0 0 1.4 -0.56 1.1284 0.109913 1.42177 -0.618135 1.06056 0.256665 1.36594 -0.458092 1.23113 -0.129423 1.42018 -0.620804 1.05721 0.263687 1.36219 -0.447639 1.24049 -0.152232 1.41404 -0.604076 1.07751 0.220842 1.38355 -0.507598 1.18385 -0.0167321 1.43524 -0.660403 1.00692 0.36629 1.29604 -0.268729 1.36667 -0.475838 1.21458 -0.0894749 1.42843 -0.643101 1.02927 0.321302 1.32764 -0.352998 1.31522 -0.340399 1.32359 -0.36209 1.3086 -0.323292 1.33474 -0.39123 1.28698 -0.268058 1.36675 -0.47606 1.21437 -0.0889759 1.42851 -0.643323 1.02899 0.321877 1.32726 -0.351976 1.31593 -0.342233 1.32235 -0.358888 1.31087 -0.329147 1.33099 -0.381405 1.29446 -0.287069 1.35643 -0.448501 1.23954 -0.149913 1.41471 -0.605908 1.07532 0.225516 1.3814 -0.501506 1.18993 -0.0309872 1.43474 -0.659402 1.00823 0.363688 1.29798 -0.273835 1.36395 -0.468584 1.22135 -0.105747 1.42546 -0.635103 ];


% just for seeing both the plots on the same figure plot
%
subplot(2,1,1), plot(x1,y1);
title('Henon Map = All values together');
subplot(2,1,2), plot(x2,y2);

% to have a different figure
% plotting only first fifty values
% it is seen that the first fifty (actually almost 75 values do not
% differ in the iterations
% 
figure;
plot(x1(1:50),y1(1:50), 'g');
hold on;
plot(x2(1:50),y2(1:50), 'm');
title('Henon Map - first 50 values', 'fontsize', 12);
text(1.25, 1.35, 'green  = float', 'HorizontalAlignment', 'left', 'color', 'g');
text(1.25, 1.25, 'magenta = double', 'HorizontalAlignment', 'left', 'color', 'm');

% last 25 data points show a difference
%
figure;
plot(x2(51:100),y2(51:100), 'g');
hold on;
plot(x1(51:100),y1(51:100), 'm');
title('Henon Map - last 50 values', 'fontsize', 12);
text(1.0, 1.35, 'green  = float', 'HorizontalAlignment', 'left', 'color', 'g');
text(1.0, 1.25, 'magenta = double', 'HorizontalAlignment', 'left', 'color', 'm');

% displaying specific points so as to show the difference as time
% progresses
% 70th point no difference 
%
text(x1(70), y1(70), '70th pt', 'color', 'g');
text(x2(70), y2(70), '70th pt', 'color', 'm');

% 85th point - a little difference
%
text(x1(85), y1(85), '85th pt', 'color', 'g');
text(x2(85), y2(85), '85th pt', 'color', 'm');

% 87th point - a big difference
%
text(x1(87), y1(87), '87th pt', 'color', 'g');
text(x2(87), y2(87), '87th pt', 'color', 'm');

figure;
for i = 1:1:100
    plot(x1(i),y1(i), 'g');
    hold on;
    plot(x2(i),y2(i), 'm');
    pause(0.1);
end;
title('Henon Map ', 'fontsize', 12);
text(1.0, 1.35, 'green  = float', 'HorizontalAlignment', 'left', 'color', 'g');
text(1.0, 1.25, 'magenta = double', 'HorizontalAlignment', 'left', 'color', 'm');

% 70th point no difference 
%
text(x1(70), y1(70), '70th pt', 'color', 'g');
text(x2(70), y2(70), '70th pt', 'color', 'm');

% 85th point - a little difference
%
text(x1(85), y1(85), '85th pt', 'color', 'g');
text(x2(85), y2(85), '85th pt', 'color', 'm');

% 87th point - a big difference
%
text(x1(87), y1(87), '87th pt', 'color', 'g');
text(x2(87), y2(87), '87th pt', 'color', 'm');
