aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/80-wahrscheinlichkeit/images/dreieck.m
diff options
context:
space:
mode:
authorLordMcFungus <mceagle117@gmail.com>2021-03-22 18:05:11 +0100
committerGitHub <noreply@github.com>2021-03-22 18:05:11 +0100
commit76d2d77ddb2bed6b7c6b8ec56648d85da4103ab7 (patch)
tree11b2d41955ee4bfa0ae5873307c143f6b4d55d26 /buch/chapters/80-wahrscheinlichkeit/images/dreieck.m
parentmore chapter structure (diff)
parentadd title image (diff)
downloadSeminarMatrizen-76d2d77ddb2bed6b7c6b8ec56648d85da4103ab7.tar.gz
SeminarMatrizen-76d2d77ddb2bed6b7c6b8ec56648d85da4103ab7.zip
Merge pull request #1 from AndreasFMueller/master
update
Diffstat (limited to 'buch/chapters/80-wahrscheinlichkeit/images/dreieck.m')
-rw-r--r--buch/chapters/80-wahrscheinlichkeit/images/dreieck.m41
1 files changed, 41 insertions, 0 deletions
diff --git a/buch/chapters/80-wahrscheinlichkeit/images/dreieck.m b/buch/chapters/80-wahrscheinlichkeit/images/dreieck.m
new file mode 100644
index 0000000..cc9661b
--- /dev/null
+++ b/buch/chapters/80-wahrscheinlichkeit/images/dreieck.m
@@ -0,0 +1,41 @@
+#
+# dreieck.m
+#
+# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+#
+w = 12
+N = 10
+
+rand("seed", 1);
+
+angles = 80 * rand(1,N)
+radii = 2 * rand(1,N) + 0.4
+angle = 20
+
+radii = radii * w / (cosd(angle) * sum(radii))
+radius = sum(radii)
+radius * cosd(angle)
+
+points = zeros(2,N);
+ray = zeros(2,N);
+
+p = [ 0; 0 ];
+for i = (1:N)
+ p = p + radii(1,i) * [ cosd(angles(1,i)); sind(angles(1,i)) ];
+ points(:, i) = p;
+ ray(:, i) = sum(radii(1,1:i)) * [ cosd(angle); sind(angle) ];
+end
+
+points
+
+ray
+
+fn = fopen("drei.inc", "w");
+for i = (1:N)
+ fprintf(fn, "\\coordinate (A%d) at (%.4f,%.4f);\n", i,
+ points(1,i), points(2,i));
+ fprintf(fn, "\\coordinate (B%d) at (%.4f,%.4f);\n", i,
+ ray(1,i), ray(2,i));
+end
+fprintf(fn, "\\def\\r{%.4f}\n", radius);
+fclose(fn);