- /
-
Haferman
on 4 Oct 2021
- 8
- 44
- 0
- 0
- 224
% https://mathworld.wolfram.com/HafermanCarpet.html
I = true;
for k = 1:5
I = num2cell(I);
idx = cellfun(@(x) x,I);
I(idx) = {logical([0 1 0;1 0 1;0 1 0])};
I(~idx) = {true(3,3)};
I = cell2mat(I);
end
I = conv2(~I,ones(3,3),'same');
imagesc(I);
axis equal off
set(gcf,'color','k')
colormap(1-hot)