aboutsummaryrefslogtreecommitdiffstats
path: root/buch/chapters/80-wahrscheinlichkeit/images/diffusion.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/diffusion.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 '')
-rw-r--r--buch/chapters/80-wahrscheinlichkeit/images/diffusion.m33
1 files changed, 33 insertions, 0 deletions
diff --git a/buch/chapters/80-wahrscheinlichkeit/images/diffusion.m b/buch/chapters/80-wahrscheinlichkeit/images/diffusion.m
new file mode 100644
index 0000000..ad56fe5
--- /dev/null
+++ b/buch/chapters/80-wahrscheinlichkeit/images/diffusion.m
@@ -0,0 +1,33 @@
+#
+# diffusion.m
+#
+# (c) 2021 Prof Dr Andreas Müller, OST Ostschweizer Fachhochschule
+#
+e1 = [ 1; 0; 0; 0; 0; 0 ];
+A = 0.8*eye(6) + 0.1*shift(eye(6),1) + 0.1*shift(eye(6),-1);
+A(1,1) = 0.9;
+A(6,6) = 0.9;
+A(1,6) = 0;
+A(6,1) = 0;
+
+N = 30;
+b = zeros(6,N);
+b(:,1) = e1;
+for i = (2:N)
+ b(:,i) = A * b(:,i-1);
+end
+b
+
+f = fopen("vektoren.inc", "w");
+for i = (1:N)
+ fprintf(f, "vektor(%d,%.4f,%.4f,%.4f,%.4f,%.4f,%.4f)\n", i,
+ b(1,i), b(2,i), b(3,i), b(4,i), b(5,i), b(6,i))
+end
+fclose(f);
+
+A1=A
+A2=A*A
+A3=A*A2
+A4=A*A3
+A5=A*A4
+A6=A*A5