\documentclass[a4paper,12pt,pdftex]{exam}

\newcommand{\ptitle}{Neural tuning and noise}
\input{../header.tex}
\firstpagefooter{Supervisor: Jan Benda}{}{email: jan.benda@uni-tuebingen.de}

\begin{document}

\input{../instructions.tex}

You are recording the activity of neurons that differ in the strength
of their intrinsic noise in response to constant stimuli of intensity
$I$ (think of that, for example, as a current $I$ injected via a
patch-electrode into the neuron).

We first characterize the neurons by their tuning curves (also called
intensity-response curves).  That is, what is the mean firing rate of
the neuron's response as a function of the constant input current $I$?

In the second part we demonstrate how intrinsic noise can be useful
for encoding stimuli on the example of the so called ``subthreshold
stochastic resonance''.

The neuron is implemented in the file \texttt{lifspikes.m}.  Call it
with the following parameters:\\[-7ex]
\begin{lstlisting}
  trials = 10;
  tmax = 50.0;
  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 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
stimulus with a constant intensity $I$ that you set. The neuron
responds to this stimulus, and you record this response. After
detecting the timepoints of the spikes in your recordings you get what
the \texttt{lifspikes()} function returns. In addition you can record
from different neurons with different noise properties by setting the
\texttt{Dnoise} parameter to different values.

\begin{questions}
  \question Tuning curves
  \begin{parts}
    \part First set the noise \texttt{Dnoise=0} (no noise). Compute
    and plot the 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 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 for example $D_{noise} = 10^{-3}$,
    $10^{-2}$, and $10^{-1}$. Depending on the resulting curves you
    might want to try additional noise levels.

    How does the intrinsic noise level influence the tuning curves?

    What are possible sources of this intrinsic noise?

    \part Show spike raster plots and interspike interval histograms
    of the responses for some interesting values of the input and the
    noise strength. For example, you might want to compare the
    responses of the different neurons to the same input, or by the
    same resulting mean firing rate.

    How do the responses differ?
  \end{parts}
  
  \question Subthreshold stochastic resonance
  
  Let's now use 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 as an input to the neuron.

  \begin{parts}
    \part  Do you get a response of the noiseless ($D_{noise}=0$) neuron?

    \part  What happens if you increase the noise strength?

    \part  What happens at really large noise strengths?

    \part  Generate some example plots that illustrate your findings.

    \part  Explain the encoding of the sine wave based on your findings
    regarding the $f$-$I$ curves.

    \part Why is this phenomenon called ``subthreshold stochastic resonance''?

  \end{parts}

\end{questions}

\end{document}