- /
-
Quasicrystal Black
on 25 Oct 2022
- 3
- 21
- 0
- 1
- 130
% Quasicrystal visualization via summation of plane waves
% Based on my File Exchange submission:
% https://mathworks.com/matlabcentral/fileexchnage/56593
N=512; % Dimension of output image
s=24; % Scale - number of periods per wave
m=4; % Integer number of plane waves to sum (m-fold symmetry)
p=2; % Phase parameter - vary to animate output
x=ones(N,1)*(-1:2/(N-1):1)*pi*s;
q=0;
for a=(0:m-1)*pi/m % Sum m plane waves over [0, pi)
q=q+cos(x*cos(a)+x'*sin(a)+p);
end
imshow((cos(q+2)+1)/2,'C',gray) % Wrap output to [0,1], apply colormap