Another way we can think about the relationship between these two frames, frame A and frame B, is that they are related by a single rotation about some arbitrary axis in space. So, the challenge becomes to determine what is this axis of rotation, the vector we going to define is v and what is the amount of rotation around that vector, which we’re going to call Theta. So the problem is to discover what is v, and what is Theta, that allows us to rotate frame A into frame B.
In order to find the axis around which we rotate there is a key observation, and that is that the axis around which we are going to rotate must be unchanged by the rotation. Any point that lies on the rotation axis will be unchanged by rotation. That implies that the rotation axis must be an eigenvector of the matrix R. A rotation matrix has got three eigenvectors. There is one eigenvector which is guaranteed to have elements that are real numbers and it corresponds to the eigenvalue of 1. There are two complex eigenvectors and they correspond to complex eigenvalues which are functions of the rotation angle Theta.
To illustrate this, I am going to create a rotation matrix. It doesn't particularly matter what the value is. I am going to create it using Euler angles. 0.1, 0.2, 0.3. And there it is. And I can see what that orientation looks like by plotting it. There we see rotated coordinate frame corresponding to this rotation matrix.
Now, I am going to look at the eigenvalues of this rotation matrix. We see that there are 3 eigenvalues, we'd expect that since it's a 3x3 matrix and the last eigenvalue is equal to one. I can look at the eigenvectors as well by asking for two output arguments from the eig function. And now we see in the matrix v, each column of matrix v is an eigenvector and we're interested in the third eigenvector because the third eigenvalue was equal to one, and we can say that this third eigenvector is real. The imaginary part of all the elements are equal to zero.
In order to find the amount of rotation as well as the axis of rotation, we would use the Toolbox function tr2angvec and pass in the rotation matrix we're interested in, and it tells it that we need a rotation of 0.44 radians around this particular vector. Now, I can get it to put those into variables by providing two output arguments; tr2angvec, and the outward variable Theta has been set to 0.4466 and the output variable v has being set to the vector around which that rotation would occur.
So the problem comes down to finding the eigenvalues and eigenvectors of the matrix R. The eigenvector corresponding to the eigenvalue of one is a rotation axis V and from the complex eigenvectors, which are a function of Theta, we can determine the rotation angle that we require.
Now, let's consider we want to do the inverse; that we have the rotation angle Theta and we have the vector about which we rotate called v, and we want to find the rotation matrix. And the equation we need is the so-called Rodriguez Equation and it relates R to v and Theta.
The inverse operation is performed by the function angvec2r, converts an angle and vector representation to a rotation matrix. I parse in the rotation amount and I parse in the vector and here is the rotation matrix, and it's exactly the same as the rotation matrix that I started with.
You’ll notice that the matrix in here is a skew symmetric matrix and this is the type of matrix that we've encountered already, and we will encounter a few other times in this course of lectures.
The orientation of a body in 3D can also be described by a single rotation about a particular axis in space.
This content assumes high school level mathematics and requires an understanding of undergraduate-level mathematics; for example, linear algebra - matrices, vectors, complex numbers, vector calculus and MATLAB programming.