% Supporting documentation for RoboKrill: a metachronal drag-based swimmer robot.
% Sara Oliveira Santos,1 Francisco Cuenca-Jiménez,2 P. Antonio Gomez-Valdez,2 Oscar Morales-Lopez,2 and Monica M. Wilhelmus 1
% 1 Brown University, Center for Fluid Mechanics, School of Engineering, Providence, RI, 02912, USA
% 2 Universidad Nacional Autónoma de México, Engineering, Circuito Interior s/n, Coyoacán, Ciudad Universitaria, C.P. 04510, México
% These values were adapted from Murphy, D. W., Webster, D. R., Kawaguchi, S., King, R., & Yen, J. (2011)....
% Metachronal swimming in {Antarctic} krill: gait kinematics and system design. Marine Biology, 158(11), 2541–2554. https://doi.org/10.1007/s00227-011-1755-y

clear all, clc, close all

t = [0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17 0.175];
alpha_P1 = [26.7 37.0 50.7 65.1 77.8 87.2 88.1 82.1 71.8 58.3 43.8 31.3 21.6 14.6 10.5 9.7 10.7 14.9 18.9];
alpha_P2 = [79.5 91.6 97.9 95.9 86.5 73.8 56.8 41.1 28.9 21.1 16.4 13.5 15.3 20.8 28.4 39.9 54.3 69.4 77.2];
alpha_P3 = [90.5 77.5 63.2 48.6 35.3 25.1 18.0 14.8 15.1 19.2 25.7 35.7 48.9 65.6 80.6 93.3 99.2 96.8 94.3];
alpha_P4 = [55.3 35.1 22.6 16.7 15.9 18.6 24.6 31.8 41.3 55.6 72.4 85.9 96.0 105.6 107.5 99.5 86.4 73.5 66.0];
alpha_P5 = [16.2 18.3 25.9 33.5 42.6 56.7 73.8 92.5 108.1 117.9 121.7 119.1 112.9 99.4 83.2 60.8 38.7 22.9 18.3];

beta_P1 = [158.1 156.3 153.8 149.6 140.6 130.2 120.8 116.1 115.8 118.1 120.8 125.4 133.3 143.3 152.4 158.0 161.1 162.2 163.3];
beta_P2 = [139.5 134.9 130.9 124.3 115.7 112.4 116.0 122.5 129.3 138.4 149.1 154.4 156.7 159.5 160.5 158.3 154.0 146.8 140.8];
beta_P3 = [123.9 116.7 110.7 108.1 112.4 122.9 135.8 145.7 151.5 156.4 160.3 160.9 156.4 150.7 144.5 138.4 133.0 128.8 126.2];
beta_P4 = [100.5 111.3 125.1 138.0 148.8 157.5 162.5 162.2 157.2 151.3 146.4 142.0 135.3 127.9 120.9 115.3 111.2 106.2 103.7];
beta_P5 = [128.1 146.5 158.1 161.6 160.2 157.1 152.4 146.2 138.8 130.2 122.6 114.7 105.7 95.3 90.2 97.1 110.5 123.4 128.1];


figure(1)
plot(t,alpha_P1,t,alpha_P2,t,alpha_P3,t,alpha_P4,t,alpha_P5,'LineWidth',3)
hTitle = title('Mean pleopod angles, \alpha')
hXLabel = xlabel('Time(s)')
hYLabel = ylabel('Angle in degrees')
% hLegend = legend({'P1','P2','P3','P4','P5'},'Orientation','horizontal','Location','Southwest')
ylim([00 130])
set( gca                       , ...
    'FontName'   , 'Arial' );
set([hTitle, hXLabel, hYLabel], ...
    'FontName'   , 'Arial');
% set([hLegend, gca]             , ...
%     'FontSize'   , 8           );
set([hXLabel, hYLabel]  , ...
    'FontSize'   , 10          );
set( hTitle                    , ...
    'FontSize'   , 16          , ...
    'FontWeight' , 'bold'      );
set(gca, ...
  'Box'         , 'off'     , ...
  'TickDir'     , 'out'     , ...
  'TickLength'  , [.02 .02] , ...
  'XMinorTick'  , 'off'      , ...
  'YMinorTick'  , 'off'      , ...
  'YGrid'       , 'off'      , ...
  'XColor'      , [.3 .3 .3], ...
  'YColor'      , [.3 .3 .3], ...
  'YTick'       , 0:20:130, ...
  'LineWidth'   , 1         );
set(gcf, 'PaperPositionMode', 'auto');
print -dpng alpha1.png
% close;

figure(2)
plot(t,beta_P1,t,beta_P2,t,beta_P3,t,beta_P4,t,beta_P5,'LineWidth',3)
hTitle = title('Mean pleopod angles, \beta')
hXLabel = xlabel('Time(s)')
hYLabel = ylabel('Angle in degrees')
% hLegend = legend({'P1','P2','P3','P4','P5'},'Orientation','horizontal')
ylim([85 170])
set( gca                       , ...
    'FontName'   , 'Arial' );
set([hTitle, hXLabel, hYLabel], ...
    'FontName'   , 'Arial');
% set([hLegend, gca]             , ...
%     'FontSize'   , 8           );
set([hXLabel, hYLabel]  , ...
    'FontSize'   , 10          );
set( hTitle                    , ...
    'FontSize'   , 16          , ...
    'FontWeight' , 'bold'      );
set(gca, ...
  'Box'         , 'off'     , ...
  'TickDir'     , 'out'     , ...
  'TickLength'  , [.02 .02] , ...
  'XMinorTick'  , 'off'      , ...
  'YMinorTick'  , 'off'      , ...
  'YGrid'       , 'off'      , ...
  'XColor'      , [.3 .3 .3], ...
  'YColor'      , [.3 .3 .3], ...
  'YTick'       , 60:20:170, ...
  'LineWidth'   , 1         );
set(gcf, 'PaperPositionMode', 'auto');
print -dpng beta1.png
% close;
