% Generate Figure 4 of manuscript (PRC plots)
% Oh & Matveev (2010)

clear;
gSyn = 0.2;
DV = 5;

fname = ['PRC_DV',num2str(DV),'.mat'];
load(fname);

fs = 16;
lfs = 12;
subplot(211);

phi = [0, phi];
PRC = [0, PRC];
plot(phi, PRC, 'k-'); 
hold on;
plot(phiN, PRCN, 'b-', 'linewidth', 3);
axis([-0.2 1 -0.05 0.8]);
xlabel('\phi', 'fontsize', lfs); 
%set(get(gca,'XLabel'),'Interpreter','latex','string','$\varphi$');
ylabel('PRC', 'fontsize', lfs);
title('{\bf A}        Pulse current perturbation (\deltaV = -5)','fontsize',fs);
legend('\Delta(\phi>0.03)', '\Delta(\phi<0.03)');

box off;

axes('pos',[0.19 0.76 0.24 0.15]);
plot(phi, PRC, 'k-'); hold on;
plot(phiN, PRCN, 'b-', 'linewidth', 2);
axis([0 0.03 -0.02 0.1]);
%box off;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(212);

fname = ['PRCp4_gSyn',num2str(gSyn),'_tSyn1.mat'];
load(fname);
I = find(PRC2 < 0); PRC2(1:I(end)) = 0;
I = find(diff(PRC2)<0); PRC2(1:I(end)) = 0;

plot(phi, PRC, 'k-'); 
title('{\bf B}      Synaptic current perturbation (g_{syn}=0.2)','fontsize',fs);
hold on;
plot(phiN, PRCN, 'b-', 'linewidth', 3);
plot(phi, PRC2, 'r-', 'linewidth', 2);
axis([-0.2 1 0 0.9]);
xlabel('\phi', 'fontsize', lfs); 
%set(get(gca,'XLabel'),'Interpreter','latex','string','$\varphi$');
%ylabel('\Delta(\phi), \Delta_2(\phi)', 'fontsize', lfs);
ylabel('STRC', 'fontsize', lfs);
legend('\Delta(\phi>0.03)', '\Delta(\phi<0.03)', '\Delta_2(\phi)');
box off;

axes('pos',[0.19 0.28 0.24 0.15]);
plot(phi, PRC, 'k-'); hold on;
plot(phiN, PRCN, 'b-', 'linewidth', 2);
axis([0 0.03 0.06 0.1]);
%box off;


