• Remix
  • Share
  • New Entry

on 3 Oct 2022
  • 3
  • 37
  • 1
  • 0
  • 270
%setup sand grid
B=219;
S=zeros(B);
%loading sand in the middle
S(110,110)=9.225e4;
while max(max(S))>1850
%identifiy sand pillars greater than 4
H=find(S>=4);
%take for sand grains from the tallest pillar
S(H)=S(H)-4;
%add sand to neighbours
S(H-1)=S(H-1)+1;
S(H+1)=S(H+1)+1;
S(H-B)=S(H-B)+1;
S(H+B)=S(H+B)+1;
end
%display the image
image(S)
colormap('flag');
axis equal
set(gca,"Position",[0 0 1 1])
set(gca,"YColor",'w')
set(gca,"XColor",'w')
set(gca,'TickDir','out')
Image
Remix Tree