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

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

R = zeros(3,3);

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