• Remix
  • Share
  • New Entry

  • Tim

  • /
  • Dunes of Mars

on 21 Oct 2021
  • 18
  • 244
  • 0
  • 0
  • 280
N=400
N = 400
H=randn(N)
H = 400×400
1.0846 -0.5188 -0.4472 1.1317 2.5901 1.3912 0.5692 1.2790 1.1475 1.2160 -1.9627 -0.4414 -1.4753 0.9306 1.3337 0.3510 -0.3995 -1.4153 0.4076 -0.8986 -0.1272 -0.9703 0.3914 -0.1044 0.5266 -1.6149 -0.3323 -1.2351 -0.0734 0.7369 -0.5485 0.6301 -0.9205 0.4497 -0.6107 0.2831 -0.6374 -0.1236 1.2827 -0.9698 0.2434 0.8846 -0.9998 -0.3692 -0.1699 2.1326 0.1824 0.6805 1.1908 -0.8159 -1.1171 -0.7869 0.3521 1.0984 0.1131 -2.3792 0.2772 0.1813 -0.4868 0.4962 -0.6871 0.3878 0.5676 1.4897 0.4025 -1.7852 -0.2767 0.6579 -0.9670 0.2122 0.0026 0.1174 0.3521 -0.8699 -1.8687 1.2720 -0.3139 -0.9584 0.5458 -0.2730 1.1846 1.1523 0.7965 -0.7674 -0.8393 0.0197 -0.4686 0.9752 -0.6147 0.4819 -0.7551 -1.2795 -0.4813 -1.6027 -0.7822 -0.2431 0.1665 -0.7910 -0.2781 0.5003 1.2457 -0.4995 0.9147 0.1728 1.4099 0.6220 -0.7629 -1.5822 -0.5618 1.9421 -0.8201 0.4905 0.4120 1.1503 -0.7667 -0.7022 -0.6939 0.6189 0.1335 -0.3026 -0.3541 -1.6123 0.2683 0.1722 -0.8134 1.3174 -0.6370 0.7021 -1.0694 0.8741 0.8484 -0.1625 -0.2280 -0.1589 0.9704 0.7216 -0.5506 0.0924 0.1292 -0.1277 1.2769 0.4348 -0.6740 1.4414 1.1061 0.3423 1.1780 -1.0209 0.2989 -0.9082 -0.4129 1.3021 0.3339 -0.3356 0.9820 1.1111 0.5296 0.6384 0.3384 -0.6931 0.4089 0.0714 0.3796 1.2595 -1.4095 -1.8892 -0.9060 -0.6347 -1.1886 0.6854 0.0812 1.1815 0.5639 -0.4758 -0.4007 0.2921 1.2305 1.2070 -0.4295 1.4177 1.1911 2.3227 -0.3487 0.9302 -0.1395 0.5107 0.2351 0.1101 -0.5840 0.4474 0.7171 0.2412 -1.2923 0.4304 0.2463 1.8985 -0.5715 -0.1089 0.6437 0.9519 1.1254 -1.4272 0.3973 -1.1074 0.5854 -0.7795 -1.4847 1.1177 0.4445 0.3466 -1.3999 -1.1598 -0.9123 -1.0005 0.2878 0.1737 -0.2351 0.4758 -0.8526 -0.3893 -0.3180 0.0484 0.4015 0.7990 -0.9291 1.8122 -1.2578 -0.0769 1.2889 -0.6887 0.9843 1.1410 -0.9177 -0.1907 -0.7751 -0.6113 0.9579 -0.3714 -0.9668 1.3119 0.2865 1.5479 -1.2791 -0.9507 -0.4578 1.6064 0.3130 0.6577 0.0977 0.7449 1.0300 -0.7434 0.2054 -0.8243 0.0529 1.6918 -1.0582 -0.1539 0.0563 -0.0417 -1.0497 -1.0912 0.1934 -0.4790 -0.2041 -0.9401 0.0832 -0.8840 1.6465 0.5759 0.1146 -1.4960 1.2080 0.0306 1.3505 -0.5759 -0.8192 -1.0108 0.8886 0.0596 0.1952 0.4818 0.8996 0.9232 0.2818 -0.5079 -0.6618 1.3267 0.3615 -1.5192 -2.1668 -1.2789 1.0690 -1.7369 -1.2393 0.3061 1.7307 -0.0844 -1.5027 -0.3644
y=1:N
y = 1×400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
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)
Image
Remix Tree