Getting a new rotation matrix from an existing one by rotating an angle about a certain axis
2 views (last 30 days)
Show older comments
I have a large set of rotation matrices from which I am trying to generate another set of rotation matrices by rotating the existing ones about certain axes by angles 1-180 degrees. So rotation matrix A would be [a11, a12, a13; a21, a22, a23; a31, a32, a33], and the B rotation matrices would be obtained by rotating A about the, say, [1 1 1] axis by angles of 1-180 degrees. Is there a way to do this that already exists? I haven't been able to find it.
0 Comments
Answers (1)
Aparajith Raghuvir
on 21 Jun 2021
It is my understanding that you are looking for a function that can rotate an object about an axis by a specific angle.
The rotate function should serve your needs. You can input a rotation matrix, an axis, and an angle alpha to rotate by.
rotate(h, direction, alpha)
where h is the object to be rotated.
2 Comments
Aparajith Raghuvir
on 22 Jun 2021
"Too many output arguments." error comes up because the rotate function doesn't have an output you can assign.
Further it was built for graphics objects, so you would need to cast rotma as an image and run it as follows:
rotate(image(rotma), [1 1 1], 60);
This will result in a figure being plotted and opened. However, since there is no ouput, fetching the values of the modified matrix needs a workaround which I have suggested below:
- Run the following command
edit rotate
- This will open up the code for the rotate function.
- Use the code to understand how the rotated values are computed.
- You will notice that 'newxyz' variable contains the rotated matrix which you can use.
- You can create your own function with the same code which returns 'newxyz' as output which you can use further in your workflow.
I hope this helps.
See Also
Categories
Find more on 3-D Scene Control in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!