From 924d00679fdf852d3b3f8e8d58c1006cf046f395 Mon Sep 17 00:00:00 2001 From: Jan Benda Date: Tue, 24 Jan 2017 11:13:45 +0100 Subject: [PATCH] added missing m file --- .../project_fano_slope/lifboltzmannspikes.m | 35 +++++++++++++++++++ projects/project_lif/lif.tex | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 projects/project_fano_slope/lifboltzmannspikes.m diff --git a/projects/project_fano_slope/lifboltzmannspikes.m b/projects/project_fano_slope/lifboltzmannspikes.m new file mode 100644 index 0000000..85ea63e --- /dev/null +++ b/projects/project_fano_slope/lifboltzmannspikes.m @@ -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 diff --git a/projects/project_lif/lif.tex b/projects/project_lif/lif.tex index e42d352..a862f6b 100644 --- a/projects/project_lif/lif.tex +++ b/projects/project_lif/lif.tex @@ -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 $