added solutions to function erecises
This commit is contained in:
parent
778fde35fa
commit
1e0320ff8e
@ -1,7 +1,7 @@
|
|||||||
%!PS-Adobe-2.0 EPSF-2.0
|
%!PS-Adobe-2.0 EPSF-2.0
|
||||||
%%Title: pointprocessscetchA.tex
|
%%Title: pointprocessscetchA.tex
|
||||||
%%Creator: gnuplot 4.6 patchlevel 4
|
%%Creator: gnuplot 4.6 patchlevel 4
|
||||||
%%CreationDate: Fri Sep 30 10:14:40 2016
|
%%CreationDate: Sat Nov 19 10:17:42 2016
|
||||||
%%DocumentFonts:
|
%%DocumentFonts:
|
||||||
%%BoundingBox: 50 50 373 135
|
%%BoundingBox: 50 50 373 135
|
||||||
%%EndComments
|
%%EndComments
|
||||||
@ -430,10 +430,10 @@ SDict begin [
|
|||||||
/Title (pointprocessscetchA.tex)
|
/Title (pointprocessscetchA.tex)
|
||||||
/Subject (gnuplot plot)
|
/Subject (gnuplot plot)
|
||||||
/Creator (gnuplot 4.6 patchlevel 4)
|
/Creator (gnuplot 4.6 patchlevel 4)
|
||||||
/Author (grewe)
|
/Author (jan)
|
||||||
% /Producer (gnuplot)
|
% /Producer (gnuplot)
|
||||||
% /Keywords ()
|
% /Keywords ()
|
||||||
/CreationDate (Fri Sep 30 10:14:40 2016)
|
/CreationDate (Sat Nov 19 10:17:42 2016)
|
||||||
/DOCINFO pdfmark
|
/DOCINFO pdfmark
|
||||||
end
|
end
|
||||||
} ifelse
|
} ifelse
|
||||||
|
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
%!PS-Adobe-2.0 EPSF-2.0
|
%!PS-Adobe-2.0 EPSF-2.0
|
||||||
%%Title: pointprocessscetchB.tex
|
%%Title: pointprocessscetchB.tex
|
||||||
%%Creator: gnuplot 4.6 patchlevel 4
|
%%Creator: gnuplot 4.6 patchlevel 4
|
||||||
%%CreationDate: Fri Sep 30 10:14:40 2016
|
%%CreationDate: Sat Nov 19 10:17:43 2016
|
||||||
%%DocumentFonts:
|
%%DocumentFonts:
|
||||||
%%BoundingBox: 50 50 373 237
|
%%BoundingBox: 50 50 373 237
|
||||||
%%EndComments
|
%%EndComments
|
||||||
@ -430,10 +430,10 @@ SDict begin [
|
|||||||
/Title (pointprocessscetchB.tex)
|
/Title (pointprocessscetchB.tex)
|
||||||
/Subject (gnuplot plot)
|
/Subject (gnuplot plot)
|
||||||
/Creator (gnuplot 4.6 patchlevel 4)
|
/Creator (gnuplot 4.6 patchlevel 4)
|
||||||
/Author (grewe)
|
/Author (jan)
|
||||||
% /Producer (gnuplot)
|
% /Producer (gnuplot)
|
||||||
% /Keywords ()
|
% /Keywords ()
|
||||||
/CreationDate (Fri Sep 30 10:14:40 2016)
|
/CreationDate (Sat Nov 19 10:17:43 2016)
|
||||||
/DOCINFO pdfmark
|
/DOCINFO pdfmark
|
||||||
end
|
end
|
||||||
} ifelse
|
} ifelse
|
||||||
|
Binary file not shown.
8
programming/code/boltzmann.m
Normal file
8
programming/code/boltzmann.m
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
function y = boltzmann( x, k )
|
||||||
|
% computes the boltzmann function
|
||||||
|
% x: scalar or vector of x values
|
||||||
|
% k: slope parameter of boltzman function
|
||||||
|
% returns y-values of boltzmann function
|
||||||
|
y = 1./(1+exp(-k*x));
|
||||||
|
end
|
||||||
|
|
3
programming/code/plotboltzmann.m
Normal file
3
programming/code/plotboltzmann.m
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
p = boltzmann(voltage, a);
|
||||||
|
plot(voltage, p)
|
||||||
|
y = -1;
|
8
programming/exercises/faculty.m
Normal file
8
programming/exercises/faculty.m
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
function x = faculty(n)
|
||||||
|
% return the faculty of n
|
||||||
|
x = 1;
|
||||||
|
for i = 1:n
|
||||||
|
x = x * i;
|
||||||
|
end
|
||||||
|
% x = prod(1:n) % this is a one line alternative to the for loop!
|
||||||
|
end
|
6
programming/exercises/facultyscripta.m
Normal file
6
programming/exercises/facultyscripta.m
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
n = 5;
|
||||||
|
x = 1;
|
||||||
|
for i = 1:n
|
||||||
|
x = x * i;
|
||||||
|
end
|
||||||
|
fprintf('Faculty of %i is: %i\n', n, x)
|
1
programming/exercises/facultyscriptb.m
Normal file
1
programming/exercises/facultyscriptb.m
Normal file
@ -0,0 +1 @@
|
|||||||
|
printfaculty(5);
|
3
programming/exercises/facultyscriptc.m
Normal file
3
programming/exercises/facultyscriptc.m
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
n = 5
|
||||||
|
a = faculty(n);
|
||||||
|
fprintf('Faculty of %i is: %i\n', n, x)
|
19
programming/exercises/plotsine.m
Normal file
19
programming/exercises/plotsine.m
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
function plotsine(freq, ampl, duration, step)
|
||||||
|
% plot a sine wave
|
||||||
|
% freq: frequency of the sinewave in Hertz
|
||||||
|
% ampl: amplitude of the sinewave
|
||||||
|
% duration: duration of the sinewave in seconds
|
||||||
|
% step: stepsize for plotting in seconds
|
||||||
|
time = 0:step:duration;
|
||||||
|
sine = ampl*sin(2*pi*freq*time);
|
||||||
|
if duration <= 1.0
|
||||||
|
plot(1000.0*time, sine);
|
||||||
|
xlabel('Time [ms]');
|
||||||
|
else
|
||||||
|
plot(time, sine);
|
||||||
|
xlabel('Time [s]');
|
||||||
|
end
|
||||||
|
ylim([-1.2*ampl 1.2*ampl]);
|
||||||
|
ylabel('Sinewave');
|
||||||
|
title(sprintf('Frequency %g Hz', freq));
|
||||||
|
end
|
9
programming/exercises/plotsine50.m
Normal file
9
programming/exercises/plotsine50.m
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
function plotsine50()
|
||||||
|
% plot a sine wave of 50Hz
|
||||||
|
time = 0:0.0001:0.2;
|
||||||
|
sine = sin(2*pi*50.0*time);
|
||||||
|
plot(1000.0*time, sine);
|
||||||
|
xlabel('Time [ms]');
|
||||||
|
ylim([-1.2 1.2]);
|
||||||
|
ylabel('Sinewave');
|
||||||
|
end
|
1
programming/exercises/plotsinea.m
Normal file
1
programming/exercises/plotsinea.m
Normal file
@ -0,0 +1 @@
|
|||||||
|
plotsine50()
|
1
programming/exercises/plotsineb.m
Normal file
1
programming/exercises/plotsineb.m
Normal file
@ -0,0 +1 @@
|
|||||||
|
plotsine(5.0, 2.0, 1.5, 0.001)
|
14
programming/exercises/plotsinec.m
Normal file
14
programming/exercises/plotsinec.m
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
freq = 5.0;
|
||||||
|
ampl = 2.0;
|
||||||
|
[time, sine] = sinewave(freq, ampl, 1.5, 0.001);
|
||||||
|
|
||||||
|
if duration <= 1.0
|
||||||
|
plot(1000.0*time, sine);
|
||||||
|
xlabel('Time [ms]');
|
||||||
|
else
|
||||||
|
plot(time, sine);
|
||||||
|
xlabel('Time [s]');
|
||||||
|
end
|
||||||
|
ylim([-1.2*ampl 1.2*ampl]);
|
||||||
|
ylabel('Sinewave');
|
||||||
|
title(sprintf('Frequency %g Hz', freq));
|
4
programming/exercises/plotsined.m
Normal file
4
programming/exercises/plotsined.m
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
freq = 5.0;
|
||||||
|
ampl = 2.0;
|
||||||
|
[time, sine] = sinewave(freq, ampl, 1.5, 0.001);
|
||||||
|
plotsinewave(time, sine);
|
13
programming/exercises/plotsinewave.m
Normal file
13
programming/exercises/plotsinewave.m
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
function plotsinewave(time, sine)
|
||||||
|
% plot precomputed sinewave
|
||||||
|
% time: vector with timepoints
|
||||||
|
% sine: corresponding vector with sinewave
|
||||||
|
if time(end)-time(1) <= 1.0
|
||||||
|
plot(1000.0*time, sine);
|
||||||
|
xlabel('Time [ms]');
|
||||||
|
else
|
||||||
|
plot(time, sine);
|
||||||
|
xlabel('Time [s]');
|
||||||
|
end
|
||||||
|
ylim([1.2*min(sine) 1.2*max(sine)]);
|
||||||
|
ylabel('Sinewave');
|
8
programming/exercises/printfaculty.m
Normal file
8
programming/exercises/printfaculty.m
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
function printfaculty(n)
|
||||||
|
% compute the faculty of n and print it
|
||||||
|
x = 1;
|
||||||
|
for i = 1:n
|
||||||
|
x = x * i;
|
||||||
|
end
|
||||||
|
fprintf('Faculty of %i is: %i\n', n, x)
|
||||||
|
end
|
13
programming/exercises/randomwalk.m
Normal file
13
programming/exercises/randomwalk.m
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
function [time, position] = randomwalk(numbersteps)
|
||||||
|
% 1-D random walk for numbersteps time steps
|
||||||
|
time = 1:numbersteps;
|
||||||
|
position = zeros(numbersteps, 1);
|
||||||
|
for i = time(2:end)
|
||||||
|
r = rand(1);
|
||||||
|
if r > 0.5
|
||||||
|
position(i) = position(i-1) + 1;
|
||||||
|
else
|
||||||
|
position(i) = position(i-1) - 1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
7
programming/exercises/randomwalkscript.m
Normal file
7
programming/exercises/randomwalkscript.m
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
n = 2000;
|
||||||
|
hold on
|
||||||
|
for k = 1:10
|
||||||
|
[t, x] = randomwalk(n);
|
||||||
|
plot(t, x)
|
||||||
|
end
|
||||||
|
hold off
|
8
programming/exercises/randomwalkscriptb.m
Normal file
8
programming/exercises/randomwalkscriptb.m
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
p = 0.5;
|
||||||
|
thresh = 50.0;
|
||||||
|
hold on
|
||||||
|
for k = 1:30
|
||||||
|
x = randomwalkthresh(p, thresh);
|
||||||
|
plot(x)
|
||||||
|
end
|
||||||
|
hold off
|
20
programming/exercises/randomwalkscriptc.m
Normal file
20
programming/exercises/randomwalkscriptc.m
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
thresh = 50.0;
|
||||||
|
probs = [0.5 0.52 0.55 0.6];
|
||||||
|
maxt = 0;
|
||||||
|
for sp = 1:4
|
||||||
|
p = probs(sp);
|
||||||
|
subplot(2, 2, sp);
|
||||||
|
hold on
|
||||||
|
for k = 1:30
|
||||||
|
x = randomwalkthresh(p, thresh);
|
||||||
|
if maxt < length(x)
|
||||||
|
maxt = length(x);
|
||||||
|
end
|
||||||
|
plot(x)
|
||||||
|
end
|
||||||
|
hold off
|
||||||
|
title(sprintf('p=%g', p))
|
||||||
|
xlabel('Time')
|
||||||
|
xlim([0 maxt])
|
||||||
|
ylabel('Position')
|
||||||
|
end
|
23
programming/exercises/randomwalkscriptd.m
Normal file
23
programming/exercises/randomwalkscriptd.m
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
thresh = 50.0;
|
||||||
|
probs = 0.5:0.01:1.0;
|
||||||
|
reps = 1000;
|
||||||
|
meancount = zeros(length(probs), 1);
|
||||||
|
stdcount = zeros(length(probs), 1);
|
||||||
|
for sp = 1:length(probs)
|
||||||
|
p = probs(sp);
|
||||||
|
positions = zeros(reps, 1);
|
||||||
|
for k = 1:reps
|
||||||
|
x = randomwalkthresh(p, thresh);
|
||||||
|
positions(k) = length(x);
|
||||||
|
end
|
||||||
|
meancount(sp) = mean(positions);
|
||||||
|
stdcount(sp) = std(positions);
|
||||||
|
end
|
||||||
|
semilogy(probs, meancount, 'displayname', 'mean');
|
||||||
|
hold on;
|
||||||
|
semilogy(probs, stdcount, 'displayname', 'std');
|
||||||
|
hold off;
|
||||||
|
xlabel('p');
|
||||||
|
xlim([0.5 1.0])
|
||||||
|
ylabel('number of steps');
|
||||||
|
legend('show');
|
25
programming/exercises/randomwalkthresh.m
Normal file
25
programming/exercises/randomwalkthresh.m
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
function positions = randomwalkthresh(p, thresh)
|
||||||
|
% computes a single random walk
|
||||||
|
%
|
||||||
|
% Arguments:
|
||||||
|
% p: the probability for an upward step
|
||||||
|
% thresh: compute the random walk until abs(pos) is larger than thresh
|
||||||
|
%
|
||||||
|
% Returns:
|
||||||
|
% positions: vector with positions of the random walker
|
||||||
|
|
||||||
|
positions = [0.0];
|
||||||
|
i = 2;
|
||||||
|
while true
|
||||||
|
r = rand(1);
|
||||||
|
if r < p
|
||||||
|
positions(i) = positions(i-1) + 1;
|
||||||
|
else
|
||||||
|
positions(i) = positions(i-1) - 1;
|
||||||
|
end
|
||||||
|
if abs(positions(i)) > thresh
|
||||||
|
break
|
||||||
|
end
|
||||||
|
i = i + 1;
|
||||||
|
end
|
||||||
|
end
|
@ -1,7 +1,9 @@
|
|||||||
\documentclass[12pt,a4paper,pdftex]{exam}
|
%\documentclass[12pt,a4paper,pdftex]{exam}
|
||||||
|
\documentclass[answers,12pt,a4paper,pdftex]{exam}
|
||||||
|
|
||||||
\usepackage[german]{babel}
|
\usepackage[german]{babel}
|
||||||
\usepackage{natbib}
|
\usepackage{natbib}
|
||||||
|
\usepackage{xcolor}
|
||||||
\usepackage{graphicx}
|
\usepackage{graphicx}
|
||||||
\usepackage[small]{caption}
|
\usepackage[small]{caption}
|
||||||
\usepackage{sidecap}
|
\usepackage{sidecap}
|
||||||
@ -24,6 +26,27 @@
|
|||||||
\setlength{\parskip}{0.3cm}
|
\setlength{\parskip}{0.3cm}
|
||||||
\renewcommand{\baselinestretch}{1.15}
|
\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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
\newcommand{\code}[1]{\texttt{#1}}
|
\newcommand{\code}[1]{\texttt{#1}}
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
@ -49,19 +72,52 @@ also als zip-Archiv auf ILIAS hochladen. Das Archiv sollte nach dem Muster:
|
|||||||
\begin{parts}
|
\begin{parts}
|
||||||
\part Version 1: berechnet die Fakult\"at von 5 und gib das
|
\part Version 1: berechnet die Fakult\"at von 5 und gib das
|
||||||
Resultat auf dem Bildschirm aus.
|
Resultat auf dem Bildschirm aus.
|
||||||
|
\begin{solution}
|
||||||
|
\lstinputlisting{facultyscripta.m}
|
||||||
|
\end{solution}
|
||||||
|
|
||||||
\part Version 2: Wie 1 aber die Funktion \"ubernimmt als Argument
|
\part Version 2: Wie 1 aber die Funktion \"ubernimmt als Argument
|
||||||
die Zahl, von der die Fakult\"at berechnet werden soll.
|
die Zahl, von der die Fakult\"at berechnet werden soll.
|
||||||
|
\begin{solution}
|
||||||
|
\lstinputlisting{printfaculty.m}
|
||||||
|
\lstinputlisting{facultyscriptb.m}
|
||||||
|
\end{solution}
|
||||||
|
|
||||||
\part Version 3: Wie 2 aber mit R\"uckgabe des berechneten Wertes.
|
\part Version 3: Wie 2 aber mit R\"uckgabe des berechneten Wertes.
|
||||||
|
\begin{solution}
|
||||||
|
\lstinputlisting{faculty.m}
|
||||||
|
\lstinputlisting{facultyscriptc.m}
|
||||||
|
\end{solution}
|
||||||
|
|
||||||
\end{parts}
|
\end{parts}
|
||||||
|
|
||||||
\question Implementiere eine Funktion, die einen Sinus mit der
|
\question Implementiere eine Funktion, die einen Sinus mit der
|
||||||
Amplitude 1 und der Frequenz $f = $ 50\,Hz plottet ($sin(2\pi \cdot
|
Amplitude 1 und der Frequenz $f = $ 50\,Hz plottet ($sin(2\pi \cdot
|
||||||
f \cdot t)$):
|
f \cdot t)$):
|
||||||
|
\begin{solution}
|
||||||
|
\lstinputlisting{plotsine50.m}
|
||||||
|
\lstinputlisting{plotsinea.m}
|
||||||
|
\end{solution}
|
||||||
\begin{parts}
|
\begin{parts}
|
||||||
\part Erweitere die Funktion sodass die L\"ange der Zeitachse, die
|
\part Erweitere die Funktion sodass die L\"ange der Zeitachse, die
|
||||||
Schrittweite, Amplitude, Frequenz als Argumente
|
Schrittweite, Amplitude, Frequenz als Argumente
|
||||||
\"ubergeben werden k\"onnen.
|
\"ubergeben werden k\"onnen.
|
||||||
|
\begin{solution}
|
||||||
|
\lstinputlisting{plotsine.m}
|
||||||
|
\lstinputlisting{plotsineb.m}
|
||||||
|
\end{solution}
|
||||||
|
|
||||||
\part Gib sowohl den Sinus als auch die Zeitachse zur\"uck.
|
\part Gib sowohl den Sinus als auch die Zeitachse zur\"uck.
|
||||||
|
\begin{solution}
|
||||||
|
\lstinputlisting{sinewave.m}
|
||||||
|
\lstinputlisting{plotsinec.m}
|
||||||
|
\end{solution}
|
||||||
|
|
||||||
|
\part Extra plot Funktion.
|
||||||
|
\begin{solution}
|
||||||
|
\lstinputlisting{plotsinewave.m}
|
||||||
|
\lstinputlisting{plotsined.m}
|
||||||
|
\end{solution}
|
||||||
\end{parts}
|
\end{parts}
|
||||||
|
|
||||||
%\question Schreibe eine Funktion, die bin\"are Datens\"atze
|
%\question Schreibe eine Funktion, die bin\"are Datens\"atze
|
||||||
@ -80,15 +136,33 @@ also als zip-Archiv auf ILIAS hochladen. Das Archiv sollte nach dem Muster:
|
|||||||
\begin{parts}
|
\begin{parts}
|
||||||
\part \"Uberlege Dir ein geeignetes ``Programmlayout'' aus
|
\part \"Uberlege Dir ein geeignetes ``Programmlayout'' aus
|
||||||
Funktionen und Skripten.
|
Funktionen und Skripten.
|
||||||
|
\begin{solution}
|
||||||
|
One function that computes one realisation of a random walk.
|
||||||
|
Scripts for plotting and analysis.
|
||||||
|
\end{solution}
|
||||||
|
|
||||||
\part Implementiere die L\"osung.
|
\part Implementiere die L\"osung.
|
||||||
|
\begin{solution}
|
||||||
|
\lstinputlisting{randomwalkthresh.m}
|
||||||
|
\lstinputlisting{randomwalkscriptb.m}
|
||||||
|
\end{solution}
|
||||||
|
|
||||||
\part Simuliere 30 Realisationen des random walk pro
|
\part Simuliere 30 Realisationen des random walk pro
|
||||||
Wahrscheinlichkeit.
|
Wahrscheinlichkeit.
|
||||||
|
|
||||||
\part Es sollen die Positionen als Funktion der Schrittanzahl
|
\part Es sollen die Positionen als Funktion der Schrittanzahl
|
||||||
geplottet werden. Erstelle einen Plot mit den je 30
|
geplottet werden. Erstelle einen Plot mit den je 30
|
||||||
Wiederholungen pro Wahrscheinlichkeitsstufe.
|
Wiederholungen pro Wahrscheinlichkeitsstufe.
|
||||||
|
\begin{solution}
|
||||||
|
\lstinputlisting{randomwalkscriptc.m}
|
||||||
|
\end{solution}
|
||||||
|
|
||||||
\part Wie entwickelt sich die mittlere ben\"otigte Schrittanzahl
|
\part Wie entwickelt sich die mittlere ben\"otigte Schrittanzahl
|
||||||
in Abh\"angigkeit der Wahrscheinlichkeit? Stelle die Mittelwerte
|
in Abh\"angigkeit der Wahrscheinlichkeit? Stelle die Mittelwerte
|
||||||
und die Standardabweichungen graphisch dar.
|
und die Standardabweichungen graphisch dar.
|
||||||
|
\begin{solution}
|
||||||
|
\lstinputlisting{randomwalkscriptd.m}
|
||||||
|
\end{solution}
|
||||||
\end{parts}
|
\end{parts}
|
||||||
|
|
||||||
%\question Modellierung des exponentiellen Wachstums einer isolierten
|
%\question Modellierung des exponentiellen Wachstums einer isolierten
|
||||||
|
12
programming/exercises/sinewave.m
Normal file
12
programming/exercises/sinewave.m
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
function [time, sine] = sinewave(freq, ampl, duration, step)
|
||||||
|
% compute sine wave with time axis
|
||||||
|
% freq: frequency of the sinewave in Hertz
|
||||||
|
% ampl: amplitude of the sinewave
|
||||||
|
% duration: duration of the sinewave in seconds
|
||||||
|
% step: stepsize for plotting in seconds
|
||||||
|
% returns:
|
||||||
|
% time: vector of time points
|
||||||
|
% sine: corresponding vector with the sine wave
|
||||||
|
time = 0:step:duration;
|
||||||
|
sine = ampl*sin(2*pi*freq*time);
|
||||||
|
end
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
\input{header}
|
\input{header}
|
||||||
|
|
||||||
\setcounter{maxexercise}{0} % show listings up to exercise maxexercise
|
\setcounter{maxexercise}{1000} % show listings up to exercise maxexercise
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
Reference in New Issue
Block a user