clear

% calc1_tw.m and calc2_tw.m should be executed before run the script!

G_orig = load('twparams_param0.txt');
G = load('twparams_all.txt');

param_num1 = 1;
param_num2 = 2;
param_num3 = 3;
param_num4 = 4;

param_p1 = (param_num1 - 1) * 12;
param_p2 = (param_num2 - 1) * 12;
param_p3 = (param_num3 - 1) * 12;
param_p4 = (param_num4 - 1) * 12;

interval = -500:10:990;

subplot(2,2,1)
plot(interval(1:111),G_orig(1:111), 'LineWidth', 2, 'Color','k')
hold on
plot(interval(1:111), G(1:111, param_p1+1), 'b-', interval(1:111), G(1:111, param_p1+7),  'b:', ... 
     interval(1:111), G(1:111, param_p1+2), 'c-', interval(1:111), G(1:111, param_p1+8),  'c:', ...
     interval(1:111), G(1:111, param_p1+3), 'g-', interval(1:111), G(1:111, param_p1+9),  'g:', ...
     interval(1:111), G(1:111, param_p1+4), 'y-', interval(1:111), G(1:111, param_p1+10), 'y:', ...
     interval(1:111), G(1:111, param_p1+5), 'r-', interval(1:111), G(1:111, param_p1+11), 'r:', ...
     interval(1:111), G(1:111, param_p1+6), 'm-', interval(1:111), G(1:111, param_p1+12), 'm:' )
axis([-500 600 0 25])
set(gca,'xtick',[-400 -200 0 200 400 600])
set(gca,'ytick',[0 5 10 15 20 25])
title(strcat('#',int2str(param_num1),' Note for UpLeft'))
xlabel('PF -> CF interval (\Deltat ms)')
ylabel('Ca2+ response (% \DeltaF/F0)')

subplot(2,2,2)
plot(interval(1:111),G_orig(1:111), 'LineWidth', 2, 'Color','k')
hold on
plot(interval(1:111), G(1:111, param_p2+1), 'b-', interval(1:111), G(1:111, param_p2+7),  'b:', ... 
     interval(1:111), G(1:111, param_p2+2), 'c-', interval(1:111), G(1:111, param_p2+8),  'c:', ...
     interval(1:111), G(1:111, param_p2+3), 'g-', interval(1:111), G(1:111, param_p2+9),  'g:', ...
     interval(1:111), G(1:111, param_p2+4), 'y-', interval(1:111), G(1:111, param_p2+10), 'y:', ...
     interval(1:111), G(1:111, param_p2+5), 'r-', interval(1:111), G(1:111, param_p2+11), 'r:', ...
     interval(1:111), G(1:111, param_p2+6), 'm-', interval(1:111), G(1:111, param_p2+12), 'm:' )
axis([-500 600 0 25])
set(gca,'xtick',[-400 -200 0 200 400 600])
set(gca,'ytick',[0 5 10 15 20 25])
title(strcat('#',int2str(param_num2),' Note for UpRight'))
xlabel('PF -> CF interval (\Deltat ms)')
ylabel('Ca2+ response (% \DeltaF/F0)')

subplot(2,2,3)
plot(interval(1:111),G_orig(1:111), 'LineWidth', 2, 'Color','k')
hold on
plot(interval(1:111), G(1:111, param_p3+1), 'b-', interval(1:111), G(1:111, param_p3+7),  'b:', ... 
     interval(1:111), G(1:111, param_p3+2), 'c-', interval(1:111), G(1:111, param_p3+8),  'c:', ...
     interval(1:111), G(1:111, param_p3+3), 'g-', interval(1:111), G(1:111, param_p3+9),  'g:', ...
     interval(1:111), G(1:111, param_p3+4), 'y-', interval(1:111), G(1:111, param_p3+10),  'y:', ...
     interval(1:111), G(1:111, param_p3+5), 'r-', interval(1:111), G(1:111, param_p3+11), 'r:', ...
     interval(1:111), G(1:111, param_p3+6), 'm-', interval(1:111), G(1:111, param_p3+12), 'm:' )
axis([-500 600 0 25])
set(gca,'xtick',[-400 -200 0 200 400 600])
set(gca,'ytick',[0 5 10 15 20 25])
title(strcat('#',int2str(param_num3),' Note for DownLeft'))
xlabel('PF -> CF interval (\Deltat ms)')
ylabel('Ca2+ response (% \DeltaF/F0)')

subplot(2,2,4)
plot(interval(1:111),G_orig(1:111), 'LineWidth', 2, 'Color','k')
hold on
plot(interval(1:111), G(1:111, param_p4+1), 'b-', interval(1:111), G(1:111, param_p4+7),  'b:', ... 
     interval(1:111), G(1:111, param_p4+2), 'c-', interval(1:111), G(1:111, param_p4+8),  'c:', ...
     interval(1:111), G(1:111, param_p4+3), 'g-', interval(1:111), G(1:111, param_p4+9),  'g:', ...
     interval(1:111), G(1:111, param_p4+4), 'y-', interval(1:111), G(1:111, param_p4+10),  'y:', ...
     interval(1:111), G(1:111, param_p4+5), 'r-', interval(1:111), G(1:111, param_p4+11), 'r:', ...
     interval(1:111), G(1:111, param_p4+6), 'm-', interval(1:111), G(1:111, param_p4+12), 'm:' )
axis([-500 600 0 25])
set(gca,'xtick',[-400 -200 0 200 400 600])
set(gca,'ytick',[0 5 10 15 20 25])
title(strcat('#',int2str(param_num4),' Note for DownRight'))
xlabel('PF -> CF interval (\Deltat ms)')
ylabel('Ca2+ response (% \DeltaF/F0)')
