\documentclass[addpoints,11pt]{exam}
\usepackage{url}
\usepackage{color}
\usepackage{hyperref}

\pagestyle{headandfoot}
\runningheadrule
\firstpageheadrule
\firstpageheader{Scientific Computing}{Project Assignment}{11/02/2014
  -- 11/05/2014}
%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014}
\firstpagefooter{}{}{{\bf Supervisor:} Jan Benda}
\runningfooter{}{}{}
\pointsinmargin
\bracketedpoints

%\printanswers
%\shadedsolutions

%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{listings}
\lstset{
 basicstyle=\ttfamily,
 numbers=left,
 showstringspaces=false,
 language=Matlab,
 breaklines=true,
 breakautoindent=true,
 columns=flexible,
 frame=single,
% captionpos=t,
 xleftmargin=2em,
 xrightmargin=1em,
% aboveskip=11pt,
 %title=\lstname,
% title={\protect\filename@parse{\lstname}\protect\filename@base.\protect\filename@ext}
 }


\begin{document}
%%%%%%%%%%%%%%%%%%%%% Submission instructions %%%%%%%%%%%%%%%%%%%%%%%%%
\sffamily
% \begin{flushright}
% \gradetable[h][questions]
% \end{flushright}

\begin{center}
  \input{../disclaimer.tex}
\end{center}

%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%

\begin{questions}
  \question You are recording the activity of a neuron in response to
  two different stimuli $I_1$ and $I_2$ (think of them, for example,
  of two sound waves with different intensities $I_1$ and $I_2$ and
  you measure the activity af an auditory neuron). Within an
  observation time of duration $W$ the neuron responds stochastically
  with $n$ spikes.

  How well can an upstream neuron discriminate the two stimuli based
  on the spike counts $n$? How does this depend on the slope of the
  tuning curve of the neural responses? How is this related to the
  fano factor (the ratio between the variance and the mean of the
  spike counts)?

  The neuron is implemented in the file \texttt{lifboltzmanspikes.m}.
  Call it with the following parameters:
\begin{lstlisting}
trials = 10;
tmax = 50.0;
Dnoise = 1.0;
imax = 25.0;
ithresh = 10.0;
slope=0.2;
input = 10.0;

spikes = lifboltzmanspikes( trials, input, tmax, Dnoise, imax, ithresh, slope );
    \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.

    For the two inputs use $I_1=10$ and $I_2=I_1 + 1$.


  \begin{parts}
    \part 
    First, show two raster plots for the responses to the two
    differrent stimuli.

    \part Measure the tuning curve of the neuron with respect to the
    input. That is, compute the mean firing rate as a function of the
    input strength. Find an appropriate range of input values.  Do
    this for different values of the \texttt{slope} parameter (values
    between 0.1 and 2.0).

    \part Generate histograms of the spike counts within $W=200$\,ms
    of the responses to the two differrent stimuli $I_1$ and
    $I_2$. How do they depend on the slope of the tuning curve of the
    neuron?

    \part Think about a measure based on the spike count histograms
    that quantifies how well the two stimuli can be distinguished
    based on the spike counts. Plot the dependence of this measure as
    a function of the observation time $W$.

    For which slopes can the two stimuli be well discriminated?

    \underline{Hint:} A possible readout is to set a threshold
    $n_{thresh}$ for the observed spike count.  Any response smaller
    than the threshold assumes that the stimulus was $I_1$, any
    response larger than the threshold assumes that the stimulus was
    $I_2$. Find the threshold $n_{thresh}$ that results in the best
    discrimination performance.

    \part Also plot the Fano factor as a function of the slope. How is
    it related to the discriminability?

    \uplevel{If you still have time you can continue with the
      following questions:}

    \part You may change the difference between the two stimuli $I_1$
    and $I_2$ as well as the intrinsic noise of the neuron via
    \texttt{Dnoise} (change it in factors of ten, higher values will
    make the responses more variable) and repeat your analysis.

    \part For $I_1=10$ the mean firing is about $80$\,Hz. When
    changing the slope of the tuning curve this firing rate may also
    change. Improve your analysis by finding for each slope the input
    that results exactly in a firing rate of $80$\,Hz. Set $I_2$ on
    unit above $I_1$.

    \part How does the dependence of the stimulus discrimination
    performance on the slope change when you set both $I_1$ and $I_2$
    such that they evoke $80$ and $100$\,Hz firing rate, respectively?

 \end{parts}

\end{questions}

\end{document}
