Merge branch 'master' of raven.am28.uni-tuebingen.de:scientificComputing
Conflicts: pointprocesses/code/binnedRate.m pointprocesses/code/convolutionRate.m pointprocesses/code/instantaneousRate.m programming/lecture/programming.tex programmingstyle/code/calculateSines.m programmingstyle/lecture/programmingstyle.tex
This commit is contained in:
@@ -3,5 +3,6 @@ counter = 1;
|
||||
x = 1;
|
||||
while counter <= n
|
||||
x = x * counter;
|
||||
counter = counter + 1
|
||||
end
|
||||
fprintf('Faculty of %i is: %i\n', n, x)
|
||||
fprintf('Faculty of %i is: %i\n', n, x)
|
||||
|
||||
@@ -3,18 +3,16 @@ if x < 0.5
|
||||
disp('x is less than 0.5');
|
||||
end
|
||||
|
||||
|
||||
if x < 0.5
|
||||
disp('x is less than 0.5!');
|
||||
else
|
||||
disp('x is greater than or equal to 0.5!')
|
||||
end
|
||||
|
||||
|
||||
if x < 0.5
|
||||
disp('x is less than 0.5!');
|
||||
elseif x < 0.75
|
||||
disp('x is greater than 0.5 but less than 0.75!');
|
||||
else
|
||||
disp('x is greater than or equal to 0.75!')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
t = 0:0.001:10;
|
||||
x = randn(size(t));
|
||||
selection = x (t > 5 & t < 6);
|
||||
selection = x(t > 5 & t < 6);
|
||||
|
||||
figure()
|
||||
hold on
|
||||
plot(t, x, 'displayname', 'measurements')
|
||||
plot(t(t > 5 & t < 6), selection, 'displayname', 'selection')
|
||||
xlabel('time [s]')
|
||||
ylabel('intensity')
|
||||
xlabel('Time [s]')
|
||||
ylabel('Intensity')
|
||||
legend 'show'
|
||||
box 'off'
|
||||
box 'off'
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
>> logicalVector
|
||||
Logischer Vektor y:
|
||||
|
||||
y =
|
||||
1 1 1 1 0 0 0 0 0 0
|
||||
|
||||
Datentyp von y: logical
|
||||
|
||||
Alle Elemente aus x, die kleiner als 5 sind:
|
||||
|
||||
ans =
|
||||
1 2 3 4
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
a = (11:20); % a vector with 10 Elements
|
||||
fprintf('length of a: %i\n', length(a))
|
||||
size_of_a = size(a); % get the size and store it in a new variable
|
||||
|
||||
% size_of_a is a vector itself
|
||||
fprintf('number of dimensions (rank) of size_of_a: %i\n', length(size_of_a))
|
||||
|
||||
% get the value of the second element of size_of_a
|
||||
fprintf('number of entries in the 2nd dimesion of a: %i\n', size_of_a(2))
|
||||
|
||||
%% Uebersichtliche Alternative?
|
||||
s = size(a); % Speicher den Rueckgabewert von size() in einer Variablen
|
||||
s(2) % Inhalt der zweiten Zahl, d.h. Laenge der 2. Dimension
|
||||
size(a,2) % Kurze Alternative
|
||||
s = size(a) % Speicher den Rueckgabewert von size() in einer Variablen
|
||||
s(2) % Inhalt der zweiten Zahl, d.h. Laenge der 2. Dimension
|
||||
size(a,2) % Die kurze Alternative
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
>> vectorsize
|
||||
length of a: 10
|
||||
number of dimensions (rank) of size_of_a: 2
|
||||
number of entries in the 2nd dimesion of a: 10
|
||||
s = 1 10
|
||||
ans = 10
|
||||
ans = 10
|
||||
|
||||
@@ -2,33 +2,13 @@ BASENAME=programming
|
||||
|
||||
#TEXFILES=boolean_logical_indexing.tex control_structures.tex data_structures.tex plotting.tex programming_basics.tex scripts_functions.tex sta_stc.tex variables_datatypes.tex vectors_matrices.tex
|
||||
|
||||
PYFILES=$(wildcard *.py)
|
||||
PYPDFFILES=$(PYFILES:.py=.pdf)
|
||||
|
||||
all : pdf
|
||||
|
||||
include ../../chapter.mk
|
||||
|
||||
# script:
|
||||
pdf : $(BASENAME)-chapter.pdf
|
||||
|
||||
$(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(PYPDFFILES) ../../header.tex
|
||||
CHAPTER=$$(( $$(sed -n -e '/contentsline {chapter}/{s/.*numberline {\([0123456789]*\)}.*/\1/; p}' $(BASENAME).aux) - 1 )); \
|
||||
PAGE=$$(sed -n -e '/contentsline {chapter}/{s/.*numberline {.*}.*}{\(.*\)}{chapter.*/\1/; p}' $(BASENAME).aux); \
|
||||
sed -i -e "s/setcounter{page}{.*}/setcounter{page}{$$PAGE}/; s/setcounter{chapter}{.*}/setcounter{chapter}{$$CHAPTER}/" $(BASENAME)-chapter.tex
|
||||
pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true
|
||||
|
||||
$(PYPDFFILES) : %.pdf : %.py
|
||||
python $<
|
||||
|
||||
clean :
|
||||
rm -f *~
|
||||
rm -f $(BASENAME).aux $(BASENAME).log
|
||||
rm -f $(BASENAME)-chapter.aux $(BASENAME)-chapter.log $(BASENAME)-chapter.out
|
||||
rm -f $(PYPDFFILES) $(GPTTEXFILES)
|
||||
|
||||
cleanall : clean
|
||||
rm -f $(BASENAME)-chapter.pdf
|
||||
|
||||
watchpdf :
|
||||
while true; do ! make -q pdf && make pdf; sleep 0.5; done
|
||||
pdf : chapter
|
||||
|
||||
clean : cleanchapter
|
||||
|
||||
cleanall : clean cleanchapter
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
\lstset{inputpath=../code}
|
||||
\graphicspath{{images/}}
|
||||
|
||||
\setcounter{page}{15}
|
||||
\setcounter{chapter}{0}
|
||||
\typein[\pagenumber]{Number of first page}
|
||||
\typein[\chapternumber]{Chapter number}
|
||||
\setcounter{page}{\pagenumber}
|
||||
\setcounter{chapter}{\chapternumber}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
@@ -14,5 +16,21 @@
|
||||
|
||||
\input{programming}
|
||||
|
||||
\section{TODO}
|
||||
\begin{itemize}
|
||||
\item Ausgabeformat: \varcode{format} ?
|
||||
\item Boolescher Ausdruck: ist doch eigentlich boolescher Ausdruck!
|
||||
\item Expliziter die \varcode{(a:b:c)} Notation einf\"uhren!
|
||||
\item Mathematische Funktionen sin(), cos(), exp()
|
||||
\item Rundungsfunktionen round(), floor(), ceil()
|
||||
\item Zeitvektoren, deltat, Umrechnung Zeit und Index.
|
||||
\item Matrizen erstmal 2-D und nur kurz n-D
|
||||
\item Zusammenfassung von Fehlermeldungen bezueglich Matrizen und Vektoren
|
||||
\item Random-walk behutsam mit einer Schleife, dann zwei Schleifen. Plus Bildchen.
|
||||
\item Doppelte for-Schleife
|
||||
\item File output and input (load, save, fprintf, scanf) (extra chapter?)
|
||||
\item help() und doc()
|
||||
\end{itemize}
|
||||
|
||||
\end{document}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user