Equations

Monday 11 April 2011

Simulating Poisson Neuron With Refractory Period

In this post, I will again simulate homogeneous Poisson neuron, but with refractory period.
T = 60000;
rate = 40;
refractoryPeriod = 3;
dt = 1;
spikeTimes = [];
isRefractory = false;
restRate = 0;
r = rate;

for t = 1 : dt : 60000,
    if r * dt / 1000 < rand(1),
        spikeTimes(i) = t;
        isRefractory = true;
        r = restRate;
    end
    
    if spikeTimes(end) - t = refractoryPeriod,
        r = rate;
        isRefractory = false;
    end
end



now lets make TIH, Survivor and Hazard functions:
isi = diff(spikeTimes);
maxIsi = ceil(max(isi) / 100) * 100;
bins = -0.5 : maxIsi - 0.5;
isiHist = hist(isi, bins);
isiHist = isiHist / sum(isiHist);

%we need the cumultative sum for the survivor function
cumTih = cumsum(isiHist);
survivorFunc = 1 - cumTih;

%hazard functions is the ISI divided by the survivor function
hazard = isiHist ./ survivorFunc;

No comments:

Post a Comment