- /
-
Dunes of Mars
on 21 Oct 2021
- 18
- 244
- 0
- 0
- 280
N=400
H=randn(N)
y=1:N
for n=1:1300
[dx,dy]=gradient(H);
dx=dx.*(y'-N/2)/N;
dy=dy.*(y-N/2)/N;
d=dx+dy;
g=(d+1)/2;
Lx=-9*(1-dx);
Ly=-9*(1-dy);
m=mod(round(y+Ly)-1,N)+1;
o=mod(round(y'+Lx)-1,N)+1;
H=conv2(H-g+accumarray([o(:),m(:)],g(:),[N,N]),ones(3)/9,'same');
% % Uncomment to watch dunes form:
% imagesc(diff(H))
% drawnow
end
imagesc(diff(H))
axis off
colormap(copper)