From a503cc5c7fcbb125ec7c220845b9e760248db233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Tue, 26 Jan 2021 13:11:37 +0100 Subject: =?UTF-8?q?Visualisierungen=20f=C3=BCr=20Perron-Frobenius-Theorie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../80-wahrscheinlichkeit/images/positiv.m | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 buch/chapters/80-wahrscheinlichkeit/images/positiv.m (limited to 'buch/chapters/80-wahrscheinlichkeit/images/positiv.m') diff --git a/buch/chapters/80-wahrscheinlichkeit/images/positiv.m b/buch/chapters/80-wahrscheinlichkeit/images/positiv.m new file mode 100644 index 0000000..4dca950 --- /dev/null +++ b/buch/chapters/80-wahrscheinlichkeit/images/positiv.m @@ -0,0 +1,36 @@ +# +# positiv.m +# +# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule +# +N = 10; +p = 0.2; + +A = eye(3) + p * rand(3,3); +A = [ + 1, 0.2, 0.2; + 0.1, 1, 0.1; + 0.05, 0.05, 1 +]; +B = eye(3); + +function retval = punkt(x) + retval = sprintf("<%.4f,%.4f,%.4f>", x(1), x(3), x(2)); +end + +fn = fopen("quadrant.inc", "w"); +for i = (1:N) + fprintf(fn, "quadrant(%s,%s,%s)\n", + punkt(B(:,1)), punkt(B(:,2)), punkt(B(:,3))) + B = B * A; +end + +x = [ 1; 1; 1 ]; +for i = (1:100) + x = A * x; + x = x / norm(x); +end +fprintf(fn, "eigenvektor(<%.4f, %.4f, %.4f>)\n", x(1), x(3), x(2)); + + +fclose(fn); -- cgit v1.2.1