Cartoon of concerted movements of sample and detector in recording crystal truncation rods in surface x-ray diffraction 

This animation shows the concerted rotations of a sample around its normal and azimuthal and polar motions of a detector so that it is looking at a crystal truncation rod as it passes through the Ewald sphere. The blue arrows represent the incident and outgoing k-vectors, the red arrow Q, the scattering vector, and the green arrow the in-plane component of Q. The CTR in this example is the (31L) rod. 

The original code was written by Christian M. Schlepuetz ca. 2008. I made some minor modifications to make it compatible with matlab_R2020b. The code uses the function arrow3, which can be downloaded at https://ch.mathworks.com/matlabcentral/fileexchange/14056-arrow3.