% ex20
% load csv as table, rename to "T" 

T.Time=T.Time/1000;
T.s11=T.s11/1000;
T.s12=T.s12/1000;
T.s13=T.s13/1000;
T.s14=T.s14/1000;

% filter out the equipment artifact at about 0.7 to1.2 Hz, and all noise
% above
%
lpFilt = designfilt('lowpassfir','PassbandFrequency',0.001, ...
         'StopbandFrequency',0.0014,'PassbandRipple',0.5, ...
         'StopbandAttenuation',65,'DesignMethod','kaiserwin');

%LineWidth
set(groot,'defaultLineLineWidth',1)

% set outer limit of 'i' for each set of readings
% this loop takes around 5 mins to run; but since the table is in RAM, the
% graphs are then fast to plot and explore
for i=2:15
T.(i)=filtfilt(lpFilt,T.(i));
end


plot(T.Time,T.s01,'DisplayName','s01');
hold on;
plot(T.Time,T.s02,'DisplayName','s02');
plot(T.Time,T.s03,'DisplayName','s03 ST36');
plot(T.Time,T.s04,'DisplayName','s04');
plot(T.Time,T.s05,'DisplayName','s05');
plot(T.Time,T.s06,'DisplayName','s06');
plot(T.Time,T.s07,'DisplayName','s07');
plot(T.Time,T.s08,'DisplayName','s08');
plot(T.Time,T.s09,'DisplayName','s09');
plot(T.Time,T.s10,'DisplayName','s10');

plot(T.Time,T.s15,'DisplayName','s15');
plot(T.Time,T.s16,'DisplayName','s16 marker');

xlabel('Time (seconds)') 
ylabel('Skin temperature (Celsius)')
axis( [0 600 25 28])
legend('show')
grid
title('(ex20) rST36 temperature and impedance')

% impedance
yyaxis right
ylabel('Impedance @40KHz (K\Omega)')
axis( [0 600 2 5])
plot(T.Time,T.s11,'DisplayName','s11 rST36');
hold on;
plot(T.Time,T.s12,'DisplayName','s12 rST36 +6mm');
plot(T.Time,T.s13,'DisplayName','s13 GB meridian');
plot(T.Time,T.s14,'DisplayName','s14 GB merid +6mm');


