To output a 4D rotation matrix in Matlab, you can use the following code:
main.m672 chars14 lines
This function takes as input a 4-dimensional array rotAngle
that specifies the rotation angles about each of the 4 axes in order. The output is a 4x4 rotation matrix rotMat
that performs the desired rotation.
The matrix elements are computed using the sine and cosine values of each input angle using the formulas for Euler angles, which combine three basic rotations about the x, y, and z axes. To perform a rotation about the 4th axis, we use a 3D matrix rotation around the x, y and z axes. The output matrix is homogeneous, therefore the last row and column are all zeros except for the (4,4) element, which is 1.
gistlibby LogSnag