fixed lif and noisefi projects
This commit is contained in:
parent
eca31e3c95
commit
c2e37b516e
@ -58,7 +58,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\le 20$\,ms and $t\ge 70$\,ms and $E(t)=10$\,mV for
|
||||
$E(t)=0$ for $t\le 20$\,ms or $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.
|
||||
|
||||
@ -92,7 +92,7 @@ time = [0.0:dt:tmax]; % t_i
|
||||
spike'' only means that we note down the time of the threshold
|
||||
crossing as a time where an action potential occurred. The
|
||||
waveform of the action potential is not modeled. Here we use a
|
||||
voltage threshold of one.
|
||||
voltage threshold of 1\,mV.
|
||||
|
||||
Write a function that implements this leaky integrate-and-fire
|
||||
neuron by expanding the function for the passive neuron
|
||||
@ -114,7 +114,6 @@ time = [0.0:dt:tmax]; % t_i
|
||||
\label{firingrate}
|
||||
r = \frac{n-1}{t_n - t_1}
|
||||
\end{equation}
|
||||
|
||||
What do you observe? Does the firing rate encode the frequency of
|
||||
the stimulus?
|
||||
\end{parts}
|
||||
|
@ -1,8 +1,8 @@
|
||||
function spikes = lifspikes(trials, input, tmax, D)
|
||||
function spikes = lifspikes(trials, current, tmax, D)
|
||||
% Generate spike times of a leaky integrate-and-fire neuron
|
||||
% trials: the number of trials to be generated
|
||||
% input: the stimulus either as a single value or as a vector
|
||||
% tmax: duration of a trial
|
||||
% current: the stimulus either as a single value or as a vector
|
||||
% tmax: duration of a trial if input is a single number
|
||||
% D: the strength of additive white noise
|
||||
|
||||
tau = 0.01;
|
||||
@ -13,7 +13,11 @@ function spikes = lifspikes(trials, input, tmax, D)
|
||||
vthresh = 10.0;
|
||||
dt = 1e-4;
|
||||
|
||||
n = ceil(tmax/dt);
|
||||
n = length( current );
|
||||
if n <= 1
|
||||
n = ceil(tmax/dt);
|
||||
current = zeros( n, 1 ) + current;
|
||||
end
|
||||
spikes = cell(trials, 1);
|
||||
for k=1:trials
|
||||
times = [];
|
||||
@ -21,7 +25,7 @@ function spikes = lifspikes(trials, input, tmax, D)
|
||||
v = vreset + (vthresh-vreset)*rand();
|
||||
noise = sqrt(2.0*D)*randn(n, 1)/sqrt(dt);
|
||||
for i=1:n
|
||||
v = v + (- v + noise(i) + input)*dt/tau;
|
||||
v = v + (- v + noise(i) + current(i))*dt/tau;
|
||||
if v >= vthresh
|
||||
v = vreset;
|
||||
times(j) = i*dt;
|
||||
|
@ -9,9 +9,6 @@
|
||||
|
||||
\input{../instructions.tex}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{REPLACE BY SUBTHRESHOLD RESONANCE PROJECT!}
|
||||
\begin{questions}
|
||||
\question You are recording the activity of a neuron in response to
|
||||
constant stimuli of intensity $I$ (think of that, for example,
|
||||
@ -19,24 +16,32 @@
|
||||
|
||||
Measure the tuning curve (also called the intensity-response curve) of the
|
||||
neuron. That is, what is the mean firing rate of the neuron's response
|
||||
as a function of the input $I$?
|
||||
as a function of the constant input current $I$?
|
||||
|
||||
How does the intensity-response curve of a neuron depend on the
|
||||
level of the intrinsic noise of the neuron?
|
||||
|
||||
How can intrinsic noise be usefull for encoding stimuli?
|
||||
|
||||
The neuron is implemented in the file \texttt{lifspikes.m}. Call it
|
||||
with the following parameters:
|
||||
with the following parameters:\\[-7ex]
|
||||
\begin{lstlisting}
|
||||
trials = 10;
|
||||
tmax = 50.0;
|
||||
input = 10.0; % the input I
|
||||
Dnoise = 1.0; % noise strength
|
||||
spikes = lifspikes(trials, input, tmax, Dnoise);
|
||||
current = 10.0; % the constant input current I
|
||||
Dnoise = 1.0; % noise strength
|
||||
spikes = lifspikes(trials, current, tmax, Dnoise);
|
||||
\end{lstlisting}
|
||||
The returned \texttt{spikes} is a cell array with \texttt{trials}
|
||||
elements, each being a vector of spike times (in seconds) computed
|
||||
for a duration of \texttt{tmax} seconds. The input is set via the
|
||||
\texttt{input} variable, the noise strength via \texttt{Dnoise}.
|
||||
for a duration of \texttt{tmax} seconds. The input current is set
|
||||
via the \texttt{current} variable, the strength of the intrinsic
|
||||
noise via \texttt{Dnoise}. If \texttt{current} is a single number,
|
||||
then an input current of that intensity is simulated for
|
||||
\texttt{tmax} seconds. Alternatively, \texttt{current} can be a
|
||||
vector containing an input current that changes in time. In this
|
||||
case, \texttt{tmax} is ignored, and you have to provide a value
|
||||
for the input current for every 0.0001\,seconds.
|
||||
|
||||
Think of calling the \texttt{lifspikes()} function as a simple way
|
||||
of doing an electrophysiological experiment. You are presenting a
|
||||
@ -52,20 +57,17 @@ spikes = lifspikes(trials, input, tmax, Dnoise);
|
||||
and plot neuron's $f$-$I$ curve, i.e. the mean firing rate (number
|
||||
of spikes within the recording time \texttt{tmax} divided by
|
||||
\texttt{tmax} and averaged over trials) as a function of the input
|
||||
for inputs ranging from 0 to 20.
|
||||
current for inputs ranging from 0 to 20.
|
||||
|
||||
How are different stimulus intensities encoded by the firing rate
|
||||
of this neuron?
|
||||
|
||||
\part Compute the $f$-$I$ curves of neurons with various noise
|
||||
strengths \texttt{Dnoise}. Use $D_{noise} = 1e-3$, $1e-2$, and
|
||||
$1e-1$.
|
||||
strengths \texttt{Dnoise}. Use for example $D_{noise} = 1e-3$,
|
||||
$1e-2$, and $1e-1$.
|
||||
|
||||
How does the intrinsic noise influence the response curve?
|
||||
|
||||
How is the encoding of stimuli influenced by increasing intrinsic
|
||||
noise?
|
||||
|
||||
What are possible sources of this intrinsic noise?
|
||||
|
||||
\part Show spike raster plots and interspike interval histograms
|
||||
@ -74,14 +76,21 @@ spikes = lifspikes(trials, input, tmax, Dnoise);
|
||||
responses of the four different neurons to the same input, or by
|
||||
the same resulting mean firing rate.
|
||||
|
||||
\part How does the coefficient of variation $CV_{isi}$ (standard
|
||||
deviation divided by mean) of the interspike intervalls depend on
|
||||
the input and the noise level?
|
||||
\part Let's now use as an input to the neuron a 1\,s long sine
|
||||
wave $I(t) = I_0 + A \sin(2\pi f t)$ with offset current $I_0$,
|
||||
amplitude $A$, and frequency $f$. Set $I_0=5$, $A=4$, and
|
||||
$f=5$\,Hz.
|
||||
|
||||
Do you get a response of the noiseless ($D_{noise}=0$) neuron?
|
||||
|
||||
What happens if you increase the noise strength?
|
||||
|
||||
What happens at really large noise strengths?
|
||||
|
||||
\part Based o your results, discuss how intrinsic noise might
|
||||
improve and how it might deteriote the encoding of different
|
||||
stimulus intensities.
|
||||
Generate some example plots that illustrate your findings.
|
||||
|
||||
Explain the encoding of the sine wave based on your findings
|
||||
regarding the $f$-$I$ curves.
|
||||
|
||||
\end{parts}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
function spikes = lifspikes(trials, input, tmax, D)
|
||||
function spikes = lifspikes(trials, current, tmax, D)
|
||||
% Generate spike times of a leaky integrate-and-fire neuron
|
||||
% trials: the number of trials to be generated
|
||||
% input: the stimulus either as a single value or as a vector
|
||||
% tmax: duration of a trial
|
||||
% current: the stimulus either as a single value or as a vector
|
||||
% tmax: duration of a trial if input is a single number
|
||||
% D: the strength of additive white noise
|
||||
|
||||
tau = 0.01;
|
||||
@ -13,7 +13,11 @@ function spikes = lifspikes(trials, input, tmax, D)
|
||||
vthresh = 10.0;
|
||||
dt = 1e-4;
|
||||
|
||||
n = ceil(tmax/dt);
|
||||
n = length( current );
|
||||
if n <= 1
|
||||
n = ceil(tmax/dt);
|
||||
current = zeros( n, 1 ) + current;
|
||||
end
|
||||
spikes = cell(trials, 1);
|
||||
for k=1:trials
|
||||
times = [];
|
||||
@ -21,7 +25,7 @@ function spikes = lifspikes(trials, input, tmax, D)
|
||||
v = vreset + (vthresh-vreset)*rand();
|
||||
noise = sqrt(2.0*D)*randn(n, 1)/sqrt(dt);
|
||||
for i=1:n
|
||||
v = v + (- v + noise(i) + input)*dt/tau;
|
||||
v = v + (- v + noise(i) + current(i))*dt/tau;
|
||||
if v >= vthresh
|
||||
v = vreset;
|
||||
times(j) = i*dt;
|
||||
|
@ -7,20 +7,34 @@ figure()
|
||||
Ds = [0, 0.001, 0.01, 0.1];
|
||||
for j = 1:length(Ds)
|
||||
D = Ds(j);
|
||||
inputs = 0.0:0.5:20.0;
|
||||
rates = ficurve(trials, inputs, tmax, D);
|
||||
plot(inputs, rates);
|
||||
currents = 0.0:0.5:20.0;
|
||||
rates = ficurve(trials, currents, tmax, D);
|
||||
plot(currents, rates);
|
||||
hold on;
|
||||
end
|
||||
hold off;
|
||||
|
||||
%% spike raster and CVs
|
||||
input = 12.0;
|
||||
figure()
|
||||
current = 12.0;
|
||||
for j = 1:length(Ds)
|
||||
D = Ds(j);
|
||||
spikes = lifspikes(trials, input, tmax, D);
|
||||
spikes = lifspikes(trials, current, tmax, D);
|
||||
subplot(4, 2, 2*j-1);
|
||||
spikeraster(spikes, 0.0, 1.0);
|
||||
subplot(4, 2, 2*j);
|
||||
isih(spikes, [0:0.001:0.04]);
|
||||
end
|
||||
|
||||
%% subthreshold resonance:
|
||||
time = [0.0:0.0001:1.0];
|
||||
current = 5.0 + 4.0*sin(2.0*pi*5.0*time);
|
||||
D = 0.1;
|
||||
spikes = lifspikes(trials, current, tmax, D);
|
||||
subplot(2, 1, 1);
|
||||
spikeraster(spikes, 0.0, 1.0);
|
||||
subplot(2, 1, 2);
|
||||
plot(time, current);
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user