Thursday, December 12, 2019

ArrayPlot Examples


ATT[xmin_,xmax_,ymin_,ymax_,
delta_,itmax_,a_,b_,col_]:=Module[{bins,d,x,y,tx,ty},
bins=ConstantArray[0,Floor[{xmax-xmin,ymax-ymin}/delta]+{1,1}];
d=Dimensions[bins]; {x,y} = {0.,0.};
Do[{x,y}={Sin[a[[1]]*y]+Cos[a[[2]]*x],Sin[b[[1]]*x]+Cos[b[[2]]*y]};
tx=Floor[(x-xmin)/delta]+1; ty=Floor[(y-ymin)/delta]+1;
If[tx>=1&&tx<=d[[1]]&&ty>=1&&ty<=d[[2]],
bins[[tx,ty]]+=1],{i,1,itmax}];
ArrayPlot[Log[bins+1],
ColorFunction->(ColorData[col,#^0.2] &),ImageSize->600]];
ATT[-2.1, 2.1,-2.1,2.1, 0.005,10^6,{-2.7,2.1},{-1.2,2.4},"AuroraColors"]

No comments:

Post a Comment