<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[addpoints,10pt]{exam}
\usepackage{url}
\usepackage{color}
\usepackage{hyperref}
\usepackage{graphicx}

\pagestyle{headandfoot}
\runningheadrule
\firstpageheadrule

\firstpageheader{Scientific Computing}{Integrate-and-fire models}{Oct 28, 2014}
%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014}
\firstpagefooter{}{}{}
\runningfooter{}{}{}
\pointsinmargin
\bracketedpoints

%\printanswers
\shadedsolutions

\usepackage[mediumspace,mediumqspace,Gray]{SIunits}      % \ohm, \micro

%%%%% 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=10pt,
 %title=\lstname,
 title={\protect\filename@parse{\lstname}\protect\filename@base.\protect\filename@ext}
 }


\begin{document}

\sffamily
%%%%%%%%%%%%%% Questions %%%%%%%%%%%%%%%%%%%%%%%%%

\begin{questions}
  \question \textbf{Statistics of integrate-and-fire neurons}
  For the following use different variants of the leaky integrate-and-fire models provided in \texttt{lifspikes.m}, 
  \texttt{lifouspikes.m}, and \texttt{lifadaptspikes.m} do generate some spike train data.
  Use the functions you wrote for the Poisson process to analyze the statistics of the spike trains.
  \begin{parts}
    \part Generate a few trials of the two models for two different inputs
    that result in qualitatively different spike trains and display
    them in a raster plot. Decide for a noise strength (good values to try are 0.001, 0.01, 0.1, 1).
    \begin{solution}
      \begin{lstlisting}
spikes = pifspikes( 10, 1.0, 0.5, 0.01 );
%spikes = pifspikes( 10, 10.0, 0.5, 0.01 );
%spikes = lifspikes( 10, 11.0, 0.5, 0.001 );
%spikes = lifspikes( 10, 15.0, 0.5, 0.001 );
spikeraster( spikes )
      \end{lstlisting}
      \mbox{}\\[-3ex]
      \colorbox{white}{\includegraphics[width=0.48\textwidth]{pifraster02}}
      \colorbox{white}{\includegraphics[width=0.48\textwidth]{pifraster10}}\\
      \colorbox{white}{\includegraphics[width=0.48\textwidth]{lifraster10}}
      \colorbox{white}{\includegraphics[width=0.48\textwidth]{lifraster15}}
    \end{solution}


    \part The inverse Gaussian describes the interspike interval distribution of a PIF driven with white noise:
    \[ p(T) = \frac{1}{\sqrt{4\pi D T^3}}\exp\left[-\frac{(T-\langle T \rangle)^2}{4DT\langle T \rangle^2}\right] \]
    where $\langle T \rangle$ is the mean interspike interval and 
    \[ D = \frac{\langle(T - \langle T \rangle)^2\rangle}{2 \langle T \rangle^3} \]
    is the diffusion coefficient (variance of the interspike intervals
    $T$ divided by two times the mean cubed). Show in two plots how
    this distribution depends on $\langle T \rangle$ and $D$.
    \begin{solution}
      \lstinputlisting{simulations/inversegauss.m}
      \lstinputlisting{simulations/inversegaussplot.m}
      \colorbox{white}{\includegraphics[width=0.98\textwidth]{inversegauss}}
    \end{solution}

    \part Extent your function plotting an interspike interval histogram
    to also report the diffusion coefficient $D$.
    \begin{solution}
      \begin{lstlisting}
...
% annotation:
misi = mean( isis );
sdisi = std( isis );
disi = sdisi^2.0/2.0/misi^3;
text( 0.6, 0.7, sprintf( 'mean=%.1f ms', 1000.0*misi ), 'Units', 'normalized' )
text( 0.6, 0.6, sprintf( 'std=%.1f ms', 1000.0*sdisi ), 'Units', 'normalized' )
text( 0.6, 0.5, sprintf( 'CV=%.2f', sdisi/misi ), 'Units', 'normalized' )
text( 0.6, 0.4, sprintf( 'D=%.1f Hz', disi ), 'Units', 'normalized' )
...
      \end{lstlisting}
    \end{solution}

    \part Compare intersike interval histograms obtained from the LIF and PIF models with the inverse Gaussian.
    \begin{solution}
      \lstinputlisting{simulations/lifisih.m}
      \colorbox{white}{\includegraphics[width=0.48\textwidth]{pifisih01}}
      \colorbox{white}{\includegraphics[width=0.48\textwidth]{pifisih10}}\\
      \colorbox{white}{\includegraphics[width=0.48\textwidth]{lifisih08}}
      \colorbox{white}{\includegraphics[width=0.48\textwidth]{lifisih16}}
    \end{solution}

    \part Plot the firing rate (inverse mean interspike interval),
    mean interspike interval, the corresponding standard deviation,
    CV, and diffusion coefficient as a function of the input to the LIF
    and the PIF with noise strength set to 0.01.
    \begin{solution}
      \lstinputlisting{simulations/lifisistats.m}
      Leaky integrate-and-fire:\\
      \colorbox{white}{\includegraphics[width=0.8\textwidth]{lifisistats}}\\
      Perfect integrate-and-fire:\\
      \colorbox{white}{\includegraphics[width=0.8\textwidth]{pifisistats}}
    \end{solution}

    \part Plot the firing rate as a function of input of the LIF and the PIF for various values
    of the noise strength.
    \begin{solution}
      \lstinputlisting{simulations/lifficurves.m}
      Leaky integrate-and-fire:\\
      \colorbox{white}{\includegraphics[width=0.7\textwidth]{lifficurves}}\\
      Perfect integrate-and-fire:\\
      \colorbox{white}{\includegraphics[width=0.7\textwidth]{pifficurves}}
    \end{solution}

    \part Use the functions for computing serial correlations, count statistics and fano factors
    to further explore the statistics of the integrate-and-fire models!

  \end{parts}
  
\end{questions}


\end{document}
</pre></body></html>