Jan Bs projects

This commit is contained in:
2014-11-02 13:35:52 +01:00
parent 123442932f
commit 896c6d858e
29 changed files with 922 additions and 7 deletions

View File

@@ -0,0 +1,10 @@
latex:
pdflatex *.tex > /dev/null
pdflatex *.tex > /dev/null
clean:
rm -rf *.log *.aux *.zip *.out auto
rm -f `basename *.tex .tex`.pdf
zip: latex
zip `basename *.tex .tex`.zip *.pdf *.dat *.mat *.m

View File

@@ -0,0 +1,119 @@
\documentclass[addpoints,10pt]{exam}
\usepackage{url}
\usepackage{color}
\usepackage{hyperref}
\pagestyle{headandfoot}
\runningheadrule
\firstpageheadrule
\firstpageheader{Scientific Computing}{Project Assignment}{11/05/2014
-- 11/06/2014}
%\runningheader{Homework 01}{Page \thepage\ of \numpages}{23. October 2014}
\firstpagefooter{}{}{}
\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=10pt,
%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$). Within an observation time of duration $W$ the neuron
responds stochastically with $n_i$ spikes.
How well can an upstream neuron discriminate the two
stimuli based on the spike counts $n_i$? How does this depend on the
duration $W$ of the observation time? How is this related to the fano factor
(the ratio between the variance and the mean of the spike counts)?
\begin{parts}
\part The neuron is implemented in the file \texttt{lifadaptspikes.m}.
Call it with the following parameters:
\begin{lstlisting}
trials = 10;
tmax = 50.0;
input = 65.0;
Dnoise = 0.1;
adapttau = 0.2;
adaptincr = 0.5;
spikes = lifadaptspikes( trials, input, tmax, Dnoise, adapttau, adaptincr );
\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.
For the two inputs $I_1$ and $I_2$ use
\begin{lstlisting}
input = 65.0; % I_1
input = 75.0; % I_2
\end{lstlisting}
Show two raster plots for the responses to the two differrent stimuli.
\part Generate histograms of the spike counts within $W$ of the
responses to the two differrent stimuli. How do they depend on the observation time $W$
(use values between 1\,ms and 1\,s)?
\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 observation times can the two stimuli perfectly discriminated?
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$. What is the
probability that the stimulus was indeed $I_1$ or $I_2$,
respectively? For a given $W$ find the threshold $n_{thresh}$ that
results in the best discrimination performance.
\part Also plot the Fano factor as a function of $W$. How is it related to the discriminability?
\uplevel{If you still have time you can continue with the following question:}
\part You may change the two stimuli $I_1$ and $I_2$ and 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.
\end{parts}
\end{questions}
\end{document}

View File

@@ -0,0 +1,53 @@
function spikes = lifadaptspikes( trials, input, tmaxdt, D, tauadapt, adaptincr )
% Generate spike times of a leaky integrate-and-fire neuron
% with an adaptation current
% trials: the number of trials to be generated
% input: the stimulus either as a single value or as a vector
% tmaxdt: in case of a single value stimulus the duration of a trial
% in case of a vector as a stimulus the time step
% D: the strength of additive white noise
% tauadapt: adaptation time constant
% adaptincr: adaptation strength
tau = 0.01;
if nargin < 4
D = 1e0;
end
if nargin < 5
tauadapt = 0.1;
end
if nargin < 6
adaptincr = 1.0;
end
vreset = 0.0;
vthresh = 10.0;
dt = 1e-4;
if max( size( input ) ) == 1
input = input * ones( ceil( tmaxdt/dt ), 1 );
else
dt = tmaxdt;
end
spikes = cell( trials, 1 );
for k=1:trials
times = [];
j = 1;
v = vreset;
a = 0.0;
noise = sqrt(2.0*D)*randn( length( input ), 1 )/sqrt(dt);
for i=1:length( noise )
v = v + ( - v - a + noise(i) + input(i))*dt/tau;
a = a + ( - a )*dt/tauadapt;
if v >= vthresh
v = vreset;
a = a + adaptincr/tauadapt;
spiketime = i*dt;
if spiketime > 4.0*tauadapt
times(j) = spiketime - 4.0*tauadapt;
j = j + 1;
end
end
end
spikes{k} = times;
end
end