added conways, handouts

This commit is contained in:
2025-03-24 00:56:41 -04:00
parent f2fb36f646
commit 7ddb2379d7
18 changed files with 95 additions and 0 deletions

12
conways/feedback/growth.m Normal file
View File

@@ -0,0 +1,12 @@
% growth function: given some matrix, determines whether a cell's neighbor
% should die or live.
% for any given entry u in matrix U:
% u == 3 --> u_iter = 1
% u > 3 OR u < 2 --> u_iter = -1
% else u = 0
function U_iter = growth(U)
K = [1 1 1; 1 0 1; 1 1 1];
U_iter = conv2(U, K, 'same');
U_iter = (U_iter == 3) - (U_iter > 3 | U_iter < 2);
end