%% Analysis of data taken at Argonne the 8/17/2011

clear, close all;

path   = '~/matlab_workspace/8inChamberfirstpulse/';

data1  = csvread([path '000.CSV'],17,1,[17,1,51+16,3]); 
data2  = csvread([path '001.CSV'],17,1,[17,1,51+16,3]); 
data3  = csvread([path '002.CSV'],17,1,[17,1,51+16,3]); 
data4  = csvread([path '003.CSV'],17,1,[17,1,51+16,3]); 
data5  = csvread([path '004.CSV'],17,1,[17,1,51+16,3]); 
data6  = csvread([path '005.CSV'],17,1,[17,1,51+16,3]); 
data7  = csvread([path '006.CSV'],17,1,[17,1,51+16,3]); 
data8  = csvread([path '007.CSV'],17,1,[17,1,51+16,3]);
data9  = csvread([path '008.CSV'],17,1,[17,1,51+16,3]); 
data10 = csvread([path '009.CSV'],17,1,[17,1,51+16,3]); 
data11 = csvread([path '010.CSV'],17,1,[17,1,51+16,3]); 
data12 = csvread([path '011.CSV'],17,1,[17,1,51+16,3]); 
data13 = csvread([path '012.CSV'],17,1,[17,1,51+16,3]); 
data14 = csvread([path '013.CSV'],17,1,[17,1,51+16,3]);

time = linspace(0,476/51*50*1/10e9,51);
time2= linspace(0,476/51*50*1/10e9,51*10);

%%
figure('Name','MCP Pulse1','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data1(:,2),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data1(:,1),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data1(:,3),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')

%%
figure('Name','MCP Pulse2','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data2(:,2),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data2(:,1),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data2(:,3),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')

%%
figure('Name','MCP Pulse3','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data3(:,2),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data3(:,1),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data3(:,3),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')

%%
figure('Name','MCP Pulse4','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data4(:,2),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data4(:,1),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data4(:,3),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')

%%
figure('Name','MCP Pulse5','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data5(:,2),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data5(:,1),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data5(:,3),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')

%%
figure('Name','MCP Pulse6','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data6(:,2),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data6(:,1),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data6(:,3),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')

%%
figure('Name','MCP Pulse7','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data7(:,2),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data7(:,1),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data7(:,3),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -25e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')

%%
figure('Name','MCP Pulse8','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data8(:,1),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data8(:,3),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data8(:,2),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')

%%
figure('Name','MCP Pulse9','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data9(:,1),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data9(:,3),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data9(:,2),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')

%%
figure('Name','MCP Pulse10','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data10(:,1),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data10(:,3),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data10(:,2),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')

%%
figure('Name','MCP Pulse11','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data11(:,1),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data11(:,3),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data11(:,2),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')


%%
figure('Name','MCP Pulse12','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data12(:,1),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data12(:,3),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data12(:,2),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')


%%
figure('Name','MCP Pulse13','NumberTitle','off')

subplot(3,1,1)
d1 = spline(time,data13(:,1),time2);
plot(time2,d1,'Color',[1,0,0]         ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,2)
d2 = spline(time,data13(:,3),time2);
plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('signal')
ylabel('Amplitude in mV')
subplot(3,1,3)
d3 = spline(time,data13(:,2),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')


% %%
% figure('Name','MCP Pulse Together','NumberTitle','off')
% 
% subplot(3,1,1)
% d8 = spline(time,data8,time2);
% d9 = spline(time,data9,time2);
% d10= spline(time,data10,time2);
% d11= spline(time,data11,time2);
% d12= spline(time,data12,time2);
% d13= spline(time,data13,time2);
% hold on
% plot(time2,d8 ,'Color',[1,0,0]         ,'LineWidth',2);
% plot(time2,d9 ,'Color',[1,0,0]         ,'LineWidth',2);
% plot(time2,d10,'Color',[1,0,0]         ,'LineWidth',2);
% plot(time2,d11,'Color',[1,0,0]         ,'LineWidth',2);
% plot(time2,d12,'Color',[1,0,0]         ,'LineWidth',2);
% plot(time2,d13,'Color',[1,0,0]         ,'LineWidth',2);
% hold off
% axis([0 476/51*50*1/10e9 -35e-3 10e-3])
% grid on
% legend('signal')
% ylabel('Amplitude in mV')
% subplot(3,1,2)
% d2 = spline(time,data10(:,3),time2);
% plot(time2,d2,'Color',[0.21,0.78,0.21],'LineWidth',2);
% axis([0 476/51*50*1/10e9 -35e-3 10e-3])
% grid on
% legend('signal')
% ylabel('Amplitude in mV')
% subplot(3,1,3)
d3 = spline(time,data10(:,2),time2);
plot(time2,d3,'Color',[0,0.4,1]       ,'LineWidth',2);
axis([0 476/51*50*1/10e9 -35e-3 10e-3])
grid on
legend('crosstalk')
xlabel('Time in s')
ylabel('Amplitude in mV')

