function R = rot_z(w)
% function R = rot_z(w)
% Prepares rotation matrix for a rotation of the x,y,z
% axes about the z-axis.  The object stays fixed.
% See gg303 lab 6
% Input parameters
% w = rotation angle (in degrees)
% Output parameters
% R = rotation matrix
% Example
% R = rot_z(30)
% X_prime = R*[1;0;0]

cosw = cos(deg2rad(w));
sinw = sin(deg2rad(w));

R = zeros(3,3);

R(1,1) = cosw;
R(1,2) = sinw;
R(1,3) = 0;
R(2,1) = -sinw;
R(2,2) = cosw;
R(2,3) = 0;
R(3,1) = 0;
R(3,2) = 0;
R(3,3) = 1;