//// Generation of Poisson spike train with refractoriness clear; clf; fr_mean=15/1000; // mean firing rate per ms //// generating poisson spike train lambda=1/fr_mean; // time interval/firing rate in interval ns=1000; // number of spikes to be generated isi1=-lambda.*log(rand(ns,1)); // generation of exponential distr. ISIs //// Delete spikes that are within refractory period is=0; for i=1:ns; if rand() > exp(-isi1(i)^2/32); is=is+1; isi(is)=isi1(i); end end //// Ploting histogram and caclulating cv histplot(50,isi); // Plot histogram of 50 bins cv=st_deviation(isi)/mean(isi) // coefficient of variation