% manypoisson.m % Multiple Poissone spike trains through synapses to see % how variable is the total synaptic conductance produced. Ncells = 100; tmax = 3.0; dt=0.001; t=0:dt:tmax; tausyn1 = 0.100; tausyn2 = 0.002; nsyn1 = 10*tausyn1/dt; nsyn2= 10*tausyn2/dt; s0 = 0.5; rate0 = 10; spikes=zeros(Ncells,length(t)); syn = zeros(Ncells,length(t)); for cell = 1: Ncells cell for i = 1:length(t) if rand(1) < dt*rate0 spikes(cell,i) = 1; synmax = s0*(1.0-syn(cell,i)); for j = i+1:min(length(t),i+nsyn1) syn(cell,j) = syn(cell,j) + synmax*exp(-dt*(j-i)/tausyn1); end end end end plot(t,syn(1,:)) hold on plot(t,syn(2,:),'r') plot(t,syn(3,:),'g') figure plot(t,mean(syn))