%% These were the plots included in the CSSS presentation
%% 

clear all
close all

%% outdata1,outdata2 and outdata3 were created from
%% outdata = malkuswheel_nd('t',10)
load outdata1 %'damp',0.005,'flow',0.3
load outdata2 %'damp',0.005,'flow',0.11
load outdata3 %'damp',0.04,'flow',0.55

figure(1)
%set(gcf,'PaperPosition',[1 1 4 6])
subplot(2,1,1)
plot(outdata1.t,outdata1.mass)
xlabel('time (s)')
ylabel('mass (kg)')
title('Mass time series in cups')

subplot(2,1,2)
plot(outdata2.t,outdata2.mass)
xlabel('time (s)')
ylabel('mass (kg)')

%print -dpng massplot.png
%print -depsc massplot.eps

figure(2)
%set(gcf,'PaperPosition',[1 1 4 6])
subplot(3,1,1)
plot(outdata1.t(find(outdata1.t>300)),outdata1.omega(find(outdata1.t>300)))
%xlabel('time (s)')
ylabel('angular velocity (rad/s)')
title('Unidirectional angular velocity - low damping, high flow')

subplot(3,1,2)
plot(outdata2.t(find(outdata2.t>300)),outdata2.omega(find(outdata2.t>300)))
%xlabel('time (s)')
ylabel('angular velocity (rad/s)')
title('Regular bi-directional angular velocity - low damping, medium flow')

subplot(3,1,3)
plot(outdata3.t(find(outdata3.t>300)),outdata3.omega(find(outdata3.t>300)))
%xlabel('time (s)')
ylabel('angular velocity (rad/s)')
title('Chaotic angular velocity - high damping, high flow')

%print -dpng omegaplot.png
%print -deps omegaplot.eps

figure(3)
%% lorenz1.mat and lorenz2.mat were saved from lorenz
%% equation simulations. Parameters are in figure titles.

load lorenz1
load lorenz2
subplot(2,1,1)
plot(t1(find(t1>465)),x1(find(t1>465)))
xlabel('t')
ylabel('x')
title('x time series from Lorenz equations: b = 8/3, \sigma = 10, r = 23.9653125')

subplot(2,1,2)
plot(t2(find(t2>465)),x2(find(t2>465)))
xlabel('t')
ylabel('x')
title('x time series from Lorenz equations: b = 8/3, \sigma = 10, r = 23.965250')

%print -dpng omega_lorenz.png
%print -deps omega_lorenz.eps

load data_omega
figure(4)
plot(outdata2.t(find(outdata2.t>315&outdata2.t<370)),outdata2.omega(find(outdata2.t>315&outdata2.t<370)),...
    t(find(t>315&t<370)),omega(find(t>315&t<370)),'--')
xlabel('t')
ylabel('omega')
title('Model and simulation comparison - angular velocity')
legend('simulation','data')
%print -dpng compare_omega.png
%print -deps compare_omega.eps

% constants2=analwheel(outdata2);
% figure(4)
% view([-120,20])
% print -dpng potato2.png
% print -deps potato2.eps

%constants1=analwheel(outdata1);
% figure(4)
% view([-120,20])
% print -dpng potato1.png
% print -deps potato1.eps

%constants3=analwheel(outdata3);
% figure(4)
% view([-120,20])
% print -dpng potato3.png
% print -deps potato3.eps


%% run wheeldata0603 to get embedded attractor
% wheeldata0630
% figure(6)
% view([-120,20])
% print -dpng potato_data.png
% print -deps potato_data.eps

%% run lorenz.data.m to get embedded attractor for lorenz equations
% figure(1)
% view([-120,20])
% print -dpng potato_omega1.png
% print -deps potato_omega1.eps
% figure(2)
% view([-120,20])
% print -dpng potato_omega3.png
% print -deps potato_omega3.eps
