function s_s_stsd

close all
tic

y0=zeros(2,1);
y0(1)=0.5;   %a probability
y0(2)=10;   %in vesicles
% y0(3)=)100; %in vesicles
% y0(4)=.01;  %in vesicles per time step
% y0(5)=0;    %in vesicles
% y0(6)=.01;  %in vesicles per time step
% y0(7)=0;    %in vesicles per time step
% y0(8)=0;    %in pA(?)

options = odeset('RelTol',1e-4,'AbsTol',[1e-4]);%,'stats','on','outputfcn','odeplot');

[t,v] = ode23t(@single_synapse_stsd_solvez,[1 500],y0,options);

figure(1);
plot(t,v(:,2),'-ro');
%axis([0 0.05 -3 1]);
%legend('input ','output ',2);
title('glutamate release from a single synapse following stimulation');
xlabel('t');
toc
% --------------------------------------------------------------------------
function dy=single_synapse_stsd_solvez(t,y)

i_vgcc=0;               %this will give the AP occurrence times and provide calcium for release
charge_per_vesicle=5;   %in pA
tau_calcium=40;
step_duration=10;
step_time=[10 300];

% for i=1:length(step_time)
	if (t>step_time(1)&t<(step_time(1)+step_duration+1)) | (t>step_time(2)&t<(step_time(2)+step_duration+1))
        i_vgcc=1;
        disp('hi'),aaa=step_time(1)
    else i_vgcc=0;
	end
% end

%y(1)=rate (probability) of release  -- should release affect the probability of release? (uniquantal rule)
%y(2)=readily releasible pool size
%y(3)=reserve pool size
%y(4)=rate of transfer of vesicles from RP to RRP
%y(5)=size of post-exocytosis pool (increments each time there is a release, until retrieved) -- should there be kiss-and-run (exocytosis w/o vesicle fusion)
%y(6)=rate of transfer of vesicles from post-exocytosis pool to RP
%y(7)=rate of transfer of vesicles from post-exocytosis pool to RRP
%y(8)=amount of transmitter in the cleft
%y(9)=
%y(10)=
%y(11)=

dy=zeros(2,1);

dy(1)=(-1/tau_calcium)*(y(1))+i_vgcc;
dy(2)=y(2)-(ceil(mod(y(1),1)-rand));
% dy(3)=;
% dy(4)=;
% dy(5)=;
% dy(6)=;
% dy(7)=;
% dy(8)=;
