Cartoon of concerted (“phonon”) vibrations of a lattice
Matlab code 

% Cartoon of phonon motion in crystal 

 

clear; close all

vid = VideoWriter('vibratingLattice.mp4','MPEG-4'); 

vid.Quality = 100; 

vid.FrameRate = 20; 

open(vid); 

set(0,'defaultfigurecolor',[1 1 1]);

set(gca,'linewidth',7); 

 

LL = 1; 

 

lp = [0.4 -0.4 0.7]; 

ec = [0.25 0.28 0.5]; % Phil blue 

fc = [1.0 0.83 0]; % Gold 

    

 

[x,y,z] = sphere; 

rad = 0.023; 

for q = 0:0.04:0.96 % time 0.04 

    newplot;

    set(gca, 'Projection','perspective');

    light('Position',lp,'Style','infinite');

    axis equal;

    axis off;

    xlim([-LL LL]);

    ylim([-LL LL]);

    zlim([-LL LL]); 

    view(0,0);

    for r = -1:0.25:1   % x 0.25

        for s = -1:0.1:1   % y 0.1

            for t = -2:0.1:2   % z 0.1

                alphaVal = exp(-2*(1+r)); 

                hold on;

                if (s+t >= -1.09) & (s+t <= 1.09)

                    surf1 = surf(s+t+x*rad,r+y*rad,-s+0.032*sin(2*pi*(t+q+r/5))+z*rad);

                    set(surf1,'FaceColor',ec,'EdgeColor','none','FaceAlpha',alphaVal);

                end     

                hold off;

            end 

        end

    end

    frame = getframe(gcf);

    writeVideo(vid,frame);

end

 

frame = getframe(gcf);

writeVideo(vid,frame);

close(vid);