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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#
# besselnodes.m
#
# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
#
global maxmu;
maxmu = 3;
global maxk;
maxk = 4;
global mu;
nachkommastellen = 4;
function retval = f(x)
global mu;
retval = besselj(mu, x);
endfunction
global kzeros;
kzeros = zeros(maxk+1, maxmu+1);
for mu = (0:maxmu)
k = 0;
x = 0.0001;
while (k <= maxk)
bracket = [ x, x+1 ];
if (f(bracket(1)) * f(bracket(2)) < 0)
kzeros(k+1,mu+1) = fzero("f", bracket);
k = k + 1;
endif
x = x + 1;
endwhile
endfor
xshift = 4;
yshift = 4;
global r;
r = 1.8;
function retval = anderefarbe(f)
if (1 == strcmp("red", f))
retval = "blue";
else
retval = "red";
endif
endfunction
function sektor(fn, mu, k, w0, w1, startfarbe)
global kzeros;
global r;
fprintf(fn, "\\begin{scope}\n");
fprintf(fn, "\\clip (0,0)--(%.4f:%.4f) arc (%.4f:%.4f:%.4f)--cycle;\n",
w0, r, w0, w1, r);
faktor = kzeros(k+1,mu+1);
K = k + 1;
farbe = startfarbe;
while (K > 0)
R = r * kzeros(K, mu+1) / faktor;
fprintf(fn, "\\fill[color=%s!20] ", farbe);
fprintf(fn, "(0,0) circle[radius=%.4f];\n", R);
farbe = anderefarbe(farbe);
K = K-1;
end
fprintf(fn, "\\end{scope}\n");
endfunction
fn = fopen("besselnodes.tex", "w");
#fprintf(fn, "\\begin{tikzpicture}[>=latex,thick]\n");
for mu = (0:maxmu)
if (mu > 0)
winkel = 180 / mu;
else
winkel = 360;
endif
for k = (0:maxk)
fprintf(fn, "\\begin{scope}[xshift=%.3fcm,yshift=-%.3fcm]\n",
mu * xshift, k * yshift);
for w0 = (0:2*winkel:360)
sektor(fn, mu, k, w0, w0 + winkel, "red");
if (winkel < 270)
sektor(fn, mu, k, w0 + winkel, w0 + 2 * winkel, "blue");
endif
endfor
fprintf(fn, "\\draw (0,0) circle[radius=%.4f];\n", r);
fprintf(fn, "\\end{scope}\n\n");
endfor
endfor
for mu = (0:maxmu)
fprintf(fn, "\\node at (%.4f,%.4f) [above] {$\\mu=%d$};\n",
mu * xshift, 0.5 * yshift, mu);
endfor
for k = (0:maxk)
fprintf(fn, "\\node at (%.4f,%.4f) [above,rotate=90] {$k=%d$};\n",
-0.5 * xshift, -k * yshift, k);
endfor
#fprintf(fn, "\\end{tikzpicture}\n");
fclose(fn);
|