diff --git a/header.tex b/header.tex index aede0ad..e13c850 100644 --- a/header.tex +++ b/header.tex @@ -216,7 +216,7 @@ \newcommand{\varcode}[1]{\setlength{\fboxsep}{0.5ex}\colorbox{codeback}{\texttt{#1}}} \newcommand{\code}[2][]{\varcode{#2}\ifthenelse{\equal{#1}{}}{\protect\sindex[code]{#2}}{\protect\sindex[code]{#1}}} \newcommand{\matlab}{\texorpdfstring{MATLAB$^{\copyright}$}{MATLAB}} -\newcommand{\matlabfun}[2][]{(\tr{\matlab-function}{\matlab-Funktion} \setlength{\fboxsep}{0.5ex}\colorbox{codeback}{\texttt{#1}})\ifthenelse{\equal{#1}{}}{\protect\sindex[code]{#2}}{\protect\sindex[code]{#1}}} +\newcommand{\matlabfun}[2][]{(\tr{\matlab-function}{\matlab-Funktion} \setlength{\fboxsep}{0.5ex}\colorbox{codeback}{\texttt{#2}})\ifthenelse{\equal{#1}{}}{\protect\sindex[code]{#2}}{\protect\sindex[code]{#1}}} %%%%% exercises environment: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % usage: diff --git a/plotting/code/automatic_plot.m b/plotting/code/automatic_plot.m index a923324..0b26a39 100644 --- a/plotting/code/automatic_plot.m +++ b/plotting/code/automatic_plot.m @@ -1,15 +1,11 @@ -clear all -close all - load('pyramidal_response.mat') threshold = 20; % mV -figure() hold on -plot(time*1000.0, neuronal_data, 'color', [0.2 0.5 0.7], 'linewidth', 1., ... - 'displayname', 'Membrane voltage') -plot(spikes*1000.0, ones(size(spikes)) .* threshold, 'r.', 'markersize', 15, ... - 'displayname', 'Spike times') +plot(time*1000.0, neuronal_data, 'color', [0.2 0.5 0.7], ... + 'linewidth', 1., 'displayname', 'Membrane voltage') +plot(spikes*1000.0, ones(size(spikes)) .* threshold, 'r.', ... + 'markersize', 15, 'displayname', 'Spike times') line([time(1) time(end)], [threshold threshold], 'linestyle', '--', ... 'linewidth', 0.75, 'color', [0.5 0.5 0.5], 'displayname', 'Threshold') @@ -24,7 +20,7 @@ set(l,'location','northeast', 'fontsize', 11, 'linewidth', 1.); set(gca, 'xminortick','on','yminortick','on') set(gca, 'tickdir','out', 'linewidth', 1.5, 'fontname', 'times', ... 'fontsize', 11) -set(gcf, 'paperunits', 'centimeters', 'papersize', [15 7.5]); -set(gcf, 'paperposition',[0.0 0.0 15, 7.5], 'color', 'white') +set(gcf, 'paperunits', 'centimeters', 'papersize', [15 7]); +set(gcf, 'paperposition',[0.0 0.0 15, 7], 'color', 'white') -saveas(gcf, [pwd '/../lecture/images/spike_detection.pdf'], 'pdf') +saveas(gcf, 'spike_detection.pdf', 'pdf') \ No newline at end of file diff --git a/plotting/lecture/images/spike_detection.pdf b/plotting/lecture/images/spike_detection.pdf index 1864b4b..e27de96 100644 Binary files a/plotting/lecture/images/spike_detection.pdf and b/plotting/lecture/images/spike_detection.pdf differ diff --git a/plotting/lecture/plotting.tex b/plotting/lecture/plotting.tex index 86164b3..f843f6f 100644 --- a/plotting/lecture/plotting.tex +++ b/plotting/lecture/plotting.tex @@ -149,6 +149,23 @@ hinzuzuf\"ugen: (i) das Graphische User Interface oder (ii) die Kommandozeile. Beide haben ihre Berechtigung sowie Vor- und Nachteile. +\begin{figure} + \begin{minipage}[t]{0.6\textwidth} + \includegraphics[height=0.29\textheight]{plot_editor} + \end{minipage} + \begin{minipage}[t]{0.3\textwidth} + \includegraphics[height=0.29\textheight]{property_editor} + \end{minipage} + \titlecaption{Der \matlab{} Plot-Editor.}{\"Uber das Menu + ``Tools $\rightarrow$ Edit Plot'' erreicht man den Plot Editor. Je nachdem + welches Element des Plots ausgew\"ahlt wurde, ver\"andern sich + die Einstellungsm\"oglichkeiten. Weitere Eigenschaften und + Einstellungen k\"onnen \"uber den ``Property Editor'', rechts, + eingesehen und ver\"andert werden. Der ``Property Editor'' ist + \"uber die Schaltfl\"ache ``More Properties'' + erreichbar.}\label{ploteditorfig} +\end{figure} + W\"ahrend es bequem ist, die Abbildung mit der GUI (\figref{ploteditorfig}) zu bearbeiten sind die erhaltenen Ergebnisse nicht einfach reproduzierbar oder \"ubertragbar. Wenn eine Abbildung @@ -170,23 +187,6 @@ Jedes dieser Elemente bietet eine Vielzahl von Einstellungsm\"oglichkeiten. Wie schon erw\"ahnt, k\"onnen diese \"uber die GUI (Abbildung \ref{ploteditorfig}) bearbeitet werden. -\begin{figure} - \begin{minipage}[t]{0.6\columnwidth} - \includegraphics[width=0.9\textwidth]{plot_editor} - \end{minipage} - \begin{minipage}[t]{0.3\columnwidth} - \includegraphics[width=0.9\textwidth]{property_editor} - \end{minipage} - \titlecaption{Der \matlab{} Plot-Editor.}{\"Uber das Menu - ``Tools $\rightarrow$ Edit Plot'' erreicht man den Plot Editor. Je nachdem - welches Element des Plots ausgew\"ahlt wurde, ver\"andern sich - die Einstellungsm\"oglichkeiten. Weitere Eigenschaften und - Einstellungen k\"onnen \"uber den ``Property Editor'', rechts, - eingesehen und ver\"andert werden. Der ``Property Editor'' ist - \"uber die Schaltfl\"ache ``More Properties'' - erreichbar.}\label{ploteditorfig} -\end{figure} - Alle Einstellungen, die \"uber das graphische Interface vorgenommen werden k\"onnen, sind auch \"uber Befehle auf der Kommandozeile m\"oglich. Auf diese Weise k\"onnen Einstellungen problemlos in ein @@ -376,20 +376,6 @@ erstes Argument wieder ein Handle auf die Figure erwartet. Das zweite Argument ist der Dateiname, und zuletzt muss das gew\"unschte Format (Box \ref{graphicsformatbox}) angegeben werden. -\lstinputlisting[caption={Skript zur Erstellung des Plots in \figref{spikedetectionfig}.}, label=niceplotlisting]{automatic_plot.m} - -\begin{figure}[t] - \includegraphics{spike_detection} - \titlecaption{Automatisch erstellter Plot.}{Dieser Plot wurde vollst\"andig - mit dem Skript in Listing \ref{niceplotlisting} erstellt und - gespeichert.}\label{spikedetectionfig} -\end{figure} - -Neben den Standard-Linienplots gibt es eine ganze Reihe weiterer -M\"oglichkeiten Daten zu Visualisieren. Mathworks zeigt auf seiner -Homepage viele Beispiele mit zugeh\"origem Code -\url{http://www.mathworks.de/discovery/gallery.html}. - \begin{ibox}[t]{\label{graphicsformatbox}Dateiformate f\"ur Abbildungen.} Es gibt zwei grunds\"atzlich verschiedene Arten von Dateiformaten f\"ur Graphiken: @@ -440,6 +426,20 @@ Homepage viele Beispiele mit zugeh\"origem Code Rastergraphik allerdings deutlich schneller und speichereffizienter. \end{ibox} +\begin{figure}[t] + \includegraphics{spike_detection} + \titlecaption{Automatisch erstellter Plot.}{Dieser Plot wurde vollst\"andig + mit dem Skript in Listing \ref{niceplotlisting} erstellt und + gespeichert.}\label{spikedetectionfig} +\end{figure} + +\lstinputlisting[caption={Skript zur Erstellung des Plots in \figref{spikedetectionfig}.}, label=niceplotlisting]{automatic_plot.m} + +Neben den Standard-Linienplots gibt es eine ganze Reihe weiterer +M\"oglichkeiten Daten zu Visualisieren. Mathworks zeigt auf seiner +Homepage viele Beispiele mit zugeh\"origem Code +\url{http://www.mathworks.de/discovery/gallery.html}. + \section{Fazit} diff --git a/programming/lecture/programming-chapter.tex b/programming/lecture/programming-chapter.tex index 3c02596..8eb19a1 100644 --- a/programming/lecture/programming-chapter.tex +++ b/programming/lecture/programming-chapter.tex @@ -5,7 +5,7 @@ \lstset{inputpath=../code} \graphicspath{{images/}} -\setcounter{page}{3} +\setcounter{page}{15} \setcounter{chapter}{0} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/programmingstyle/lecture/programmingstyle.tex b/programmingstyle/lecture/programmingstyle.tex index 9d9db0d..35b3c88 100644 --- a/programmingstyle/lecture/programmingstyle.tex +++ b/programmingstyle/lecture/programmingstyle.tex @@ -223,7 +223,7 @@ end end \end{lstlisting} -\clearpage +\pagebreak[4] \begin{lstlisting}[label=cleancode, caption={\"Ubersichtliche Implementation des Random-walk.}] num_runs = 10; @@ -272,6 +272,7 @@ ein v\"ollig unn\"otiger Kommentar. \end{itemize} \end{important} +\pagebreak[4] \section{Dokumentation von Funktionen} Bei allen vordefinierten \matlab{} Funktionen findet sich am Anfang @@ -330,6 +331,7 @@ sogenannte \codeterm[Funktion!lokale]{lokale Funktionen} oder auch erstellen. Listing \ref{localfunctions} zeigt ein Beispiel f\"ur eine lokale Funktion. +\pagebreak[3] \lstinputlisting[label=localfunctions, caption={Beispiel f\"ur den Einsatz von lokalen Funktionen.}]{calculate_sines.m} diff --git a/statistics/code/checkmymedian.m b/statistics/code/checkmymedian.m index 14cbe0b..d2d101d 100644 --- a/statistics/code/checkmymedian.m +++ b/statistics/code/checkmymedian.m @@ -1,9 +1,9 @@ % check whether the median returned by mymedian % really separates a vector into two halfs -for i = 1:140 % loop over different length - for k = 1:10 % try several times - a = randn( i, 1 ); % generate some data - m = mymedian( a ); % compute median +for i = 1:140 % loop over different length + for k = 1:10 % try several times + a = randn( i, 1 ); % generate some data + m = mymedian( a ); % compute median if length( a(a>m) ) ~= length( a(a=x1)&(x=x1)&(r