aboutsummaryrefslogtreecommitdiffstats
path: root/vorlesungen/slides/fresnel/eulerspirale.m
blob: 312541a3af9659d80c7f678617a0ca1891f17d57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#
# eulerspirale.m
#
# (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschlue
#
global n;
n = 10000;
global tmax;
tmax = 10;

function retval = f(x, t)
	retval = [ cos(t*t); sin(t*t) ];
endfunction

x0 = [ 0; 0 ];
t = tmax * (0:n) / n;

c = lsode(@f, x0, t);

fn = fopen("eulerpath.tex", "w");

fprintf(fn, "\\def\\fresnela{ (0,0)");
for i = (2:n)
	fprintf(fn, "\n\t-- (%.4f,%.4f)", c(i,1), c(i,2));
end
fprintf(fn, "\n}\n");

fprintf(fn, "\\def\\fresnelb{ (0,0)");
for i = (2:n)
	fprintf(fn, "\n\t-- (%.4f,%.4f)", -c(i,1), -c(i,2));
end
fprintf(fn, "\n}\n");

fclose(fn);