"comment">% Last edited: 5/3/2017</span>
0015 
0016 
0017 <span class="comment">% Rotation matrix</span>
0018 Rz = [cos(phi) sin(phi) 0;<span class="keyword">...</span>
0019     -sin(phi) cos(phi) 0;<span class="keyword">...</span>
0020     0 0 1];
0021 
0022 <span class="comment">% Rotate every element in the matrix</span>
0023 <span class="keyword">for</span> i=1:size(X,2)
0024     <span class="keyword">for</span> j = 1:size(X,1)
0025         XYZ = [X(j,i);Y(j,i);Z(j,i)];
0026         Rotated = Rz*XYZ;
00