201 lines
		
	
	
		
			7.3 KiB
		
	
	
	
		
			TeX
		
	
	
	
	
	
			
		
		
	
	
			201 lines
		
	
	
		
			7.3 KiB
		
	
	
	
		
			TeX
		
	
	
	
	
	
\documentclass[12pt,a4paper,pdftex]{exam}
 | 
						|
 | 
						|
\usepackage[german]{babel}
 | 
						|
\usepackage{pslatex}
 | 
						|
\usepackage[mediumspace,mediumqspace,Gray]{SIunits}      % \ohm, \micro
 | 
						|
\usepackage{xcolor}
 | 
						|
\usepackage{graphicx}
 | 
						|
\usepackage[breaklinks=true,bookmarks=true,bookmarksopen=true,pdfpagemode=UseNone,pdfstartview=FitH,colorlinks=true,citecolor=blue]{hyperref}
 | 
						|
 | 
						|
%%%%% layout %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
						|
\usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry}
 | 
						|
\pagestyle{headandfoot}
 | 
						|
\ifprintanswers
 | 
						|
\newcommand{\stitle}{L\"osungen}
 | 
						|
\else
 | 
						|
\newcommand{\stitle}{\"Ubung}
 | 
						|
\fi
 | 
						|
\header{{\bfseries\large \stitle}}{{\bfseries\large Punktprozesse 2}}{{\bfseries\large 27. Oktober, 2015}}
 | 
						|
\firstpagefooter{Prof. Dr. Jan Benda}{Phone: 29 74573}{Email:
 | 
						|
jan.benda@uni-tuebingen.de}
 | 
						|
\runningfooter{}{\thepage}{}
 | 
						|
 | 
						|
\setlength{\baselineskip}{15pt}
 | 
						|
\setlength{\parindent}{0.0cm}
 | 
						|
\setlength{\parskip}{0.3cm}
 | 
						|
\renewcommand{\baselinestretch}{1.15}
 | 
						|
 | 
						|
%%%%% listings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
						|
\usepackage{listings}
 | 
						|
\lstset{
 | 
						|
  language=Matlab,
 | 
						|
  basicstyle=\ttfamily\footnotesize,
 | 
						|
  numbers=left,
 | 
						|
  numberstyle=\tiny,
 | 
						|
  title=\lstname,
 | 
						|
  showstringspaces=false,
 | 
						|
  commentstyle=\itshape\color{darkgray},
 | 
						|
  breaklines=true,
 | 
						|
  breakautoindent=true,
 | 
						|
  columns=flexible,
 | 
						|
  frame=single,
 | 
						|
  xleftmargin=1em,
 | 
						|
  xrightmargin=1em,
 | 
						|
  aboveskip=10pt
 | 
						|
}
 | 
						|
 | 
						|
%%%%% math stuff: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
						|
\usepackage{amsmath}
 | 
						|
\usepackage{amssymb}
 | 
						|
\usepackage{bm} 
 | 
						|
\usepackage{dsfont}
 | 
						|
\newcommand{\naZ}{\mathds{N}}
 | 
						|
\newcommand{\gaZ}{\mathds{Z}}
 | 
						|
\newcommand{\raZ}{\mathds{Q}}
 | 
						|
\newcommand{\reZ}{\mathds{R}}
 | 
						|
\newcommand{\reZp}{\mathds{R^+}}
 | 
						|
\newcommand{\reZpN}{\mathds{R^+_0}}
 | 
						|
\newcommand{\koZ}{\mathds{C}}
 | 
						|
 | 
						|
%%%%% page breaks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
						|
\newcommand{\continue}{\ifprintanswers%
 | 
						|
\else
 | 
						|
\vfill\hspace*{\fill}$\rightarrow$\newpage%
 | 
						|
\fi}
 | 
						|
\newcommand{\continuepage}{\ifprintanswers%
 | 
						|
\newpage
 | 
						|
\else
 | 
						|
\vfill\hspace*{\fill}$\rightarrow$\newpage%
 | 
						|
\fi}
 | 
						|
\newcommand{\newsolutionpage}{\ifprintanswers%
 | 
						|
\newpage%
 | 
						|
\else
 | 
						|
\fi}
 | 
						|
 | 
						|
%%%%% new commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
						|
\newcommand{\qt}[1]{\textbf{#1}\\}
 | 
						|
\newcommand{\pref}[1]{(\ref{#1})}
 | 
						|
\newcommand{\extra}{--- Zusatzaufgabe ---\ \mbox{}}
 | 
						|
\newcommand{\code}[1]{\texttt{#1}}
 | 
						|
 | 
						|
 | 
						|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
						|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
						|
\begin{document}
 | 
						|
 | 
						|
\input{instructions}
 | 
						|
 | 
						|
 | 
						|
\begin{questions}
 | 
						|
 | 
						|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
						|
\question \qt{Homogener Poisson Prozess}
 | 
						|
Wir wollen den homogenen Poisson Prozess benutzen um Spikes zu generieren,
 | 
						|
mit denen wir die Analysfunktionen des vorherigen \"Ubungszettel \"uberpr\"ufen k\"onnen.
 | 
						|
 | 
						|
Ein homogener Poisson Prozess mit der Rate $\lambda$ (measured in Hertz) ist ein Punktprozess,
 | 
						|
bei dem die Wahrschienlichkeit eines Ereignisses unabh\"angig von der Zeit $t$ und
 | 
						|
unabh\"angig von vorherigen Ereignissen ist.
 | 
						|
Die Wahrscheinlichkeit $P$ eines Ereignisses innerhalb eines Bins der Breite $\Delta t$ ist
 | 
						|
\[ P = \lambda \cdot \Delta t \]
 | 
						|
f\"ur gen\"ugend kleine $\Delta t$.
 | 
						|
\begin{parts}
 | 
						|
  
 | 
						|
  \part Schreibe eine Funktion die $n$ homogene Poisson Spiketrains
 | 
						|
  einer gegebenen Dauer $T_{max}$ mit rate $\lambda$ erzeugt.
 | 
						|
  \begin{solution}
 | 
						|
    \lstinputlisting{hompoissonspikes.m}
 | 
						|
  \end{solution}
 | 
						|
  
 | 
						|
  \part Benutze diese Funktion um einige Trials von Spikes zu erzeugen
 | 
						|
  und plotte diese als Spikeraster.
 | 
						|
  \begin{solution}
 | 
						|
    \begin{lstlisting}
 | 
						|
      spikes = hompoissonspikes( 10, 100.0, 0.5 );
 | 
						|
      spikeraster( spikes )
 | 
						|
    \end{lstlisting}
 | 
						|
    \mbox{}\\[-3ex]
 | 
						|
    \colorbox{white}{\includegraphics[width=0.7\textwidth]{poissonraster100hz}}
 | 
						|
  \end{solution}
 | 
						|
  
 | 
						|
  \part Berechne Histogramme aus den Interspikeintervallen von $n$
 | 
						|
  Poisson Spiketrains mit der Rate $\lambda=100$\,Hz. Ver\"andere
 | 
						|
  \"uber die Dauer $T_{max}$ der Spiketrains und die Anzahl $n$ der
 | 
						|
  Trials die Anzahl der Intervalle und ver\"andere auch die Binbreite
 | 
						|
  des Histograms (fange mit 1\,ms an). Wieviele Interspikeintervalle
 | 
						|
  werden ben\"otigt um ein ``sch\"ones'' Histogramm zu erhalten? Wie
 | 
						|
  lange m\"usste man also von dem Neuron ableiten?
 | 
						|
  \begin{solution}
 | 
						|
    About 5000 intervals for 25 bins. This corresponds to a $5000 /
 | 
						|
    100\,\hertz = 50\,\second$ recording of a neuron firing with
 | 
						|
    100\,\hertz.
 | 
						|
  \end{solution}
 | 
						|
  
 | 
						|
  \part Vergleiche das Histogramm mit der zu erwartenden Verteilung
 | 
						|
  der Intervalle $T$ des Poisson Prozesses
 | 
						|
  \[ p(T) = \lambda e^{-\lambda T} \]
 | 
						|
  mit rate $\lambda$.
 | 
						|
  \begin{solution}
 | 
						|
    \lstinputlisting{hompoissonisih.m}
 | 
						|
    \colorbox{white}{\includegraphics[width=0.48\textwidth]{poissonisih100hz}}
 | 
						|
    \colorbox{white}{\includegraphics[width=0.48\textwidth]{poissonisih20hz}}
 | 
						|
  \end{solution}
 | 
						|
  
 | 
						|
  \part \extra Was pasiert mit den Histogrammen, wenn die Binbreite der Histogramme kleiner
 | 
						|
  als das bei der Erzeugung der $\Delta t$ der 
 | 
						|
  used for generating the Poisson spikes?
 | 
						|
  \begin{solution}
 | 
						|
    The bins between the discretization have zero entries. Therefore
 | 
						|
    the other ones become higher than they should be.
 | 
						|
  \end{solution}
 | 
						|
  
 | 
						|
  \part Plot the mean interspike interval, the corresponding standard deviation, and the CV
 | 
						|
  as a function of the rate $\lambda$ of the Poisson process.
 | 
						|
  Compare the ../code with the theoretical expectations for the dependence on $\lambda$.
 | 
						|
  \begin{solution}
 | 
						|
    \lstinputlisting{hompoissonisistats.m}
 | 
						|
    \colorbox{white}{\includegraphics[width=0.98\textwidth]{poissonisistats}}
 | 
						|
  \end{solution}
 | 
						|
  
 | 
						|
  \part Write a function that computes serial correlations for the interspike intervals
 | 
						|
  for a range of lags.
 | 
						|
  The serial correlations $\rho_k$ at lag $k$ are defined as
 | 
						|
  \[ \rho_k = \frac{\langle (T_{i+k} - \langle T \rangle)(T_i - \langle T \rangle) \rangle}{\langle (T_i - \langle T \rangle)^2\rangle} = \frac{{\rm cov}(T_{i+k}, T_i)}{{\rm var}(T_i)} \]
 | 
						|
  Use this function to show that interspike intervals of Poisson spikes are independent.
 | 
						|
  \begin{solution}
 | 
						|
    \lstinputlisting{../code/isiserialcorr.m}
 | 
						|
    \colorbox{white}{\includegraphics[width=0.98\textwidth]{poissonserial100hz}}
 | 
						|
  \end{solution}
 | 
						|
  
 | 
						|
  \part Write a function that generates from spike times 
 | 
						|
  a histogram of spike counts in a count window of given duration $W$.
 | 
						|
  The function should also plot the Poisson distribution
 | 
						|
  \[ P(k) = \frac{(\lambda W)^ke^{\lambda W}}{k!} \]
 | 
						|
  for the rate $\lambda$ determined from the spike trains.
 | 
						|
  \begin{solution}
 | 
						|
    \lstinputlisting{../code/counthist.m}
 | 
						|
    \colorbox{white}{\includegraphics[width=0.48\textwidth]{poissoncounthistdist100hz10ms}}
 | 
						|
    \colorbox{white}{\includegraphics[width=0.48\textwidth]{poissoncounthistdist100hz100ms}}
 | 
						|
  \end{solution}
 | 
						|
  
 | 
						|
  \part Write a function that computes mean count, variance of count and the corresponding Fano factor
 | 
						|
  for a range of count window durations. The function should generate tow plots: one plotting
 | 
						|
  the count variance against the mean, the other one the Fano factor as a function of the window duration.
 | 
						|
  \begin{solution}
 | 
						|
    \lstinputlisting{../code/fano.m}
 | 
						|
    \colorbox{white}{\includegraphics[width=0.98\textwidth]{poissonfano100hz}}
 | 
						|
  \end{solution}
 | 
						|
  
 | 
						|
\end{parts}
 | 
						|
 | 
						|
\end{questions}
 | 
						|
 | 
						|
\end{document}
 | 
						|
 | 
						|
 | 
						|
 Zus\"atzlich soll die Funktion
 | 
						|
    die Poisson-Verteilung
 | 
						|
    \[ P(k) = \frac{(\lambda W)^ke^{\lambda W}}{k!} \] mit der Rate
 | 
						|
    $\lambda$, die aus den Daten bestimmt werden kann, mit zu dem
 | 
						|
    Histogramm hineinzeichen. Hinweis: es gibt eine \code{matlab} Funktion,
 | 
						|
    die die Fakult\"at $n!$ berechnet. |