remove underscores from funktion names

This commit is contained in:
Jan Grewe 2015-11-22 13:02:25 +01:00
parent a945268bee
commit 0e196d5e80
6 changed files with 24 additions and 23 deletions

View File

@ -1,6 +1,6 @@
function [time, rate] = binned_rate(spike_times, bin_width, dt, t_max)
% Calculates the firing rate with the binning method. The hist funciton is
% used to count the number of spikes in each bin.
function [time, rate] = binnedRate(spike_times, bin_width, dt, t_max)
% Calculates the firing rate with the binning method. The hist
% function is used to count the number of spikes in each bin.
% Arguments:
% spike_times, vector containing the times of the spikes.
% bin_width, the width of the bins in seconds.

View File

@ -1,8 +1,9 @@
function [time, rate] = convolution_rate(spike_times, sigma, dt, t_max)
function [time, rate] = convolutionRate(spike_times, sigma, dt, t_max)
% Calculates the firing rate with the convolution method.
% Arguments:
% spike_times, a vector containing the spike times.
% sigma, the standard deviation of the Gaussian kernel in seconds.
% sigma, the standard deviation of the Gaussian kernel
% in seconds.
% dt, the temporal resolution in seconds.
% t_max, the trial duration in seconds.
%
@ -12,13 +13,13 @@ time = 0:dt:t_max - dt;
rate = zeros(size(time));
spike_indices = round(spike_times / dt);
rate(spike_indices) = 1;
kernel = gauss_kernel(sigma, dt);
kernel = gaussKernel(sigma, dt);
rate = conv(rate, kernel, 'same');
end
function y = gauss_kernel(s, step)
function y = gaussKernel(s, step)
x = -4 * s:step:4 * s;
y = exp(-0.5 .* (x ./ s) .^ 2) ./ sqrt(2 * pi) / s;
end

View File

@ -1,4 +1,4 @@
function [time, rate] = instantaneous_rate(spike_times, dt, t_max)
function [time, rate] = instantaneousRate(spike_times, dt, t_max)
% Function calculates the firing rate as the inverse of the interspike
% interval.
% Arguments:
@ -6,7 +6,7 @@ function [time, rate] = instantaneous_rate(spike_times, dt, t_max)
% dt, the temporal resolutions of the recording.
% t_max, the duration of the trial.
%
% Returns the vector representing time and a vector containing the rate.
% Returns two vectors containing the time and the rate.
time = 0:dt:t_max-dt;
rate = zeros(size(time));

View File

@ -1174,9 +1174,9 @@ ab und liefert ein Ergebnis $y$ zur\"uck. Listing
wird.
\begin{lstlisting}[caption={Funktionsdefinition in \matlab{}}, label=functiondefinitionlisting]
function [y] = function_name(arg_1, arg_2)
% ^ ^ ^
% Rueckgabewert Argument_1, Argument_2
function [y] = functionName(arg_1, arg_2)
% ^ ^ ^
% Rueckgabewert Argument_1, Argument_2
\end{lstlisting}
Ein Funktion beginnt mit dem Schl\"usselwort \code{function} gefolgt
@ -1205,7 +1205,7 @@ Funktion, die eine Reihe von Sinusschwingungen unterschiedlicher
Frequenzen berechnet und graphisch darstellt.
\begin{lstlisting}[caption={Eine Beispielfunktion, die eine Reihe Sinusse plottet.},label=badsinewavelisting]
function meine_erste_funktion() % Funktionskopf
function meineErsteFunktion() % Funktionskopf
t = (0:0.01:2); % hier faengt der Funktionskoerper an
frequenz = 1.0;
amplituden = [0.25 0.5 0.75 1.0 1.25];
@ -1256,7 +1256,7 @@ welche Daten sie zur\"uckliefern soll.
\begin{enumerate}
\item \codeterm{Name:} der Name sollte beschreiben, was die Funktion
tut. In diesem Fall berechnet sie einen Sinus. Ein geeigneter Name
w\"are also \code{calculate\_sinewave}.
w\"are also \code{calculateSinewave}.
\item \codeterm{Argumente:} die zu brechnende Sinusschwingung sei durch
ihre Frequenz und die Amplitude bestimmt. Des Weiteren soll noch
festgelegt werden, wie lang der Sinus sein soll und mit welcher
@ -1271,7 +1271,7 @@ Mit dieser Information ist es nun gut m\"oglich die Funktion zu
implementieren (Listing \ref{sinefunctionlisting}).
\begin{lstlisting}[caption={Funktion, die einen Sinus berechnet.}, label=sinefunctionlisting]
function [time, sine] = calculate_sinewave(frequency, amplitude, t_max, t_step)
function [time, sine] = calculateSinewave(frequency, amplitude, t_max, t_step)
% The function calculates a sinewave with a given frequency and
% amplitude.
% Arguments: frequency, the frequency of the sine
@ -1289,7 +1289,7 @@ function [time, sine] = calculate_sinewave(frequency, amplitude, t_max, t_step)
Diese Aufgabe kann auch von einer Funktion \"ubernommen werden. Diese
Funktion hat keine andere Aufgabe, als die Daten zu plotten. Ihr Name
sollte sich an dieser Aufgabe orientieren
(z.B. \code{plot\_sinewave}). Um einen einzelnen Sinus zu plotten
(z.B. \code{plotSinewave}). Um einen einzelnen Sinus zu plotten
werden im Wesentlichen die x-Werte und die zugeh\"origen y-Werte
ben\"otigt. Da mehrere Sinus geplottet werden sollen ist es auch
sinnvoll eine Zeichenkette f\"ur die Legende an die Funktion zu
@ -1297,7 +1297,7 @@ sinnvoll eine Zeichenkette f\"ur die Legende an die Funktion zu
R\"uckgabewert ben\"otigt (Listing \ref{sineplotfunctionlisting}).
\begin{lstlisting}[caption={Funktion, die die Daten plottet.}, label=sineplotfunctionlisting]
function plot_sinewave(x_data, y_data, name)
function plotSinewave(x_data, y_data, name)
% Plots x-data against y-data and sets the display name.
% Arguments: x_data, the x-data
% y_data, the y-data
@ -1329,9 +1329,9 @@ figure()
hold on
for i = 1:length(amplitudes)
[x_data, y_data] = calculate_sinewave(frequency, amplitudes(i), ...
[x_data, y_data] = calculateSinewave(frequency, amplitudes(i), ...
t_max, t_step);
plot_sinewave(x_data, y_data, sprintf('freq: %5.2f, ampl: %5.2f',...
plotSinewave(x_data, y_data, sprintf('freq: %5.2f, ampl: %5.2f',...
frequency, amplitudes(i)))
end
legend('show')

View File

@ -1,4 +1,4 @@
function sines = calculate_sines(x, amplitudes, frequencies)
function sines = calculateSines(x, amplitudes, frequencies)
% Function calculates sinewaves with all combinations of
% given amplitudes and frequencies.
% Arguments: x, a vector of radiants for which the sine should be
@ -12,12 +12,12 @@ function sines = calculate_sines(x, amplitudes, frequencies)
sines = zeros(length(x), length(amplitudes), length(frequencies));
for i = 1:length(amplitudes)
sines(:,i,:) = sines_with_frequencies(x, amplitudes(i), frequencies);
sines(:,i,:) = sinesWithFrequencies(x, amplitudes(i), frequencies);
end
end
function sines = sines_with_frequencies(x, amplitude, frequencies)
function sines = sinesWithFrequencies(x, amplitude, frequencies)
sines = zeros(length(x), length(frequencies));
for i = 1:length(frequencies)
sines(:,i) = sinewave(x, amplitude, frequencies(i));

View File

@ -328,7 +328,7 @@ M\"oglichkeit sogenannte \codeterm{lokale Funktionen} oder auch
erstellen. Listing \ref{localfunctions} zeigt ein Beispiel f\"ur eine
lokale Funktion.
\lstinputlisting[label=localfunctions, caption={\codeterm{Lokale Funktionen} erh\"ohen die Lesbarkeit sind aber nur innerhalb der definierenden Datei verf\"ugbar.}]{calculate_sines.m}
\lstinputlisting[label=localfunctions, caption={\codeterm{Lokale Funktionen} erh\"ohen die Lesbarkeit sind aber nur innerhalb der definierenden Datei verf\"ugbar.}]{calculateSines.m}
Lokale Funktionen existieren in der gleichen Datei und sind nur dort
verf\"ugbar. Jede Funktion hat ihren eigenen G\"ultigkeitsbereich, das