aboutsummaryrefslogtreecommitdiffstats
path: root/vorlesungen/slides/fresnel/eulerspirale.m
blob: 84e3696c1f0d400fdd5e56e821b3de660ec4affc (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#
# eulerspirale.m
#
# (c) 2022 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschlue
#
global n;
n = 1000;
global tmax;
tmax = 10;
global N;
N = round(n*5/tmax);

function retval = f(x, t)
	x = pi * t^2 / 2;
	retval = [ cos(x); sin(x) ];
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\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\n");

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

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

fprintf(fn, "\\def\\Splotright{ (0,0)");
for i = (2:N)
	fprintf(fn, "\n\t-- ({%.4f*\\dx},{%.4f*\\dy})", t(i), c(i,2));
end
fprintf(fn, "\n}\n\n");

fprintf(fn, "\\def\\Splotleft{ (0,0)");
for i = (2:N)
	fprintf(fn, "\n\t-- ({%.4f*\\dx},{%.4f*\\dy})", -t(i), -c(i,2));
end
fprintf(fn, "\n}\n\n");

fclose(fn);