Rotate frame around a specific axis in spectrometer.
Ori = rotateframe(Ori0,nRot,rho)
rotateframe rotates the frame described by the three Euler angles (in radians) in Ori0 by the angle rho (in radians) around the rotation axis nRot, returning the rotated frames in Ori.
Ori0 describes the frame orientation before the rotation. It is a row vector of three Euler angles (in radians). See the page on frames for details.
nRot is the axis of rotation. For example, the vector nRot = [1;0;0] indicates the rotation axis is x. In general, the vector nRot = [a;b;c] means that the space-fixed rotation axis is a*x+b*y+c*z, where x, y and z are the unit vectors of the space-fixed frame. nRot does not have to be normalized.
rho is the angle of rotation, in units of radians. The rotation is defined in a positive sense around the rotation axis nRot. rho can be be a single number or an array. If an array is given, rotateframe calculates the rotated frame for each angle in the rho array.
The output Ori is a set of Euler angles that describe the new frame orientations resulting from the rotation. If rho contains more than one value, Ori contains multiple rows, with one Euler angle set per row.
Here is a simple example that involves the rotation of a crystal around the lab x axis.
clear xL = [1;0;0]; % space-fixed x axis rho = 20*pi/180; % rotation angle (radians) ori0 = [40 65 0]*pi/180; % initial frame orientation ori = rotateframe(ori0,xL,rho); % frame orientation after rotation
This function uses rotaxi2mat to perform the rotation. Also, see the page on frames and Euler angles for more details.
ang2vec, erot, eulang, rotaxi2mat, rotmat2axi, vec2ang