% This file is licensed under the Allen Institute Terms of Use, which can be found at:
%http://www.alleninstitute.org/Media/policies/terms_of_use_content.html

%------------------------------------------------------------------------------------

%Script to generate Fig. 1f) showing 95% confidence intervals using saved 
%data for 5mV and 100Hz input with current-based synapses

clear variables;

% Settings for plot
fnt = 35;
fntleg = 25;
xtc = [0;50;100;150;200]*10^-3;  %x-axis ticks for time in (ms)
ytc = [0;5;10;15;20]*10^-3; %y-axis ticks for membrane potential in (mV)
xtl = [0;50;100;150;200]; %x-axis labels for time in (ms)
ytl = [0;5;10;15;20]; %y-axis labels for membrane potential in (mV)

set(0,'DefaultFigureWindowStyle','docked');
set(0,'defaultAxesFontName', 'Arial');

load 'Fig1data.mat';

figure;

%FIRING RATE PLOTs
%-----------------
plot(tplot, simfrate_curr(1:end-1),'b','LineWidth',4);
set(gca,'XTick',xtc);
set(gca,'XTickLabel',xtl);
hold on;
plot(t_curr_dipde,fout_curr_dipde, 'r--', 'LineWidth',4);
plot(t_curr_dipde,fout_curr_up, '--', 'LineWidth',4 ,'Color',[0,0.5,0])
plot(t_curr_dipde,fout_curr_low, '--', 'LineWidth',4,'Color',[0.2,0,0.5])
set(gca, 'FontSize',fnt);
set(gca,'FontSize',fnt);
ylabel('Firing rate (Hz)');xlabel('time (ms)');
axis square tight;
leg1=legend('Sim','DiPDE','DiPDE up','DiPDE low','Location','SouthEast');
set(leg1, 'FontSize',fntleg);

print2eps Fig1f_CI.eps
