function R = rotMat( phi )

% Returns the 2x2 matrix that rotates a 2D column vector by angle phi:
%   [rotX;rotY] = R*[X;Y] with
%   rotX = X*cos(phi)-Y*sin(phi)
%   rotY = X*sin(phi)+Y*cos(phi)
% Input:
%   phi  : rotation angle (counter clockwise, in rad)
% Output:
%   R    : rotation matrix
% Usage:
%   R = rotMat( pi/4 )
%   newVec = R*vec
% Author:
%   J.M.Soler. Sept.2010

R = [ cos(phi)  -sin(phi)
      sin(phi)   cos(phi) ];

end % function rotMat
