added missing m file

This commit is contained in:
Jan Benda 2017-01-24 11:13:45 +01:00
parent f69e99491b
commit 924d00679f
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,35 @@
function spikes = lifboltzmannspikes(trials, input, tmax, gain)
% Generate spike times of a leaky integrate-and-fire neuron.
% trials: the number of trials to be generated.
% input: the stimulus intensity.
% tmax: the duration of a trial.
% gain: gain of the neuron, i.e. the slope factor of the boltzmann input.
tau = 0.01;
D = 1e-2;
imax = 25;
ithresh = 10;
slope = gain;
vreset = 0.0;
vthresh = 10.0;
dt = 1e-4;
n = ceil(tmax/dt);
inb = imax./(1.0+exp(-slope.*(input - ithresh)));
spikes = cell(trials, 1);
for k=1:trials
times = [];
j = 1;
v = vreset;
noise = sqrt(2.0*D)*randn(n, 1)/sqrt(dt);
for i=1:n
v = v + (- v + noise(i) + inb)*dt/tau;
if v >= vthresh
v = vreset;
times(j) = i*dt;
j = j + 1;
end
end
spikes{k} = times;
end
end

View File

@ -94,7 +94,7 @@ time = [0.0:dt:tmax]; % t_i
\part Response of the passive membrane to a step input.
Set $V_0=0$. Construct a vector for the input $E(t)$ such that
$E(t)=0$ for $t<20$\,ms and $t>70$\,ms and $E(t)=10$\,mV for
$E(t)=0$ for $t\le 20$\,ms and $t\ge 70$\,ms and $E(t)=10$\,mV for
$20$\,ms $<t<70$\,ms. Plot $E(t)$ and the resulting $V(t)$ for
$t_{max}=120$\,ms.