How can I get a 3D rotation matrix

2 次查看(过去 30 天)
How can I get a 3D rotation matrix by only knowing a degree? That means, firstly, set a degree, say, 10, then generate a 3D rotation matrix randomly in order that for any unit vector v from the origin, the angle between v and the rotated vector Rv would be 10 degree. Thank you so much!!

采纳的回答

Mike Garrity
Mike Garrity 2015-6-2
If you look at the command makehgtform , you'll find a form that looks like this:
M = makehgtform('axisrotate',[ax ay az],t)
The axis [ax ay az] needs to be normal to the vector you want to rotate. As others have noted in the comments, this matrix will apply the same rotation to all of the vectors which lie in the plane which is normal to [ax ay az], but it will rotate vectors which do not lie in that plane by a smaller amount.
The angle t is in radians, so you'll need to convert.
Also, this command returns a 4x4 matrix because it supports translations. You just want the upper 3x3.

更多回答(1 个)

James Tursa
James Tursa 2015-6-1
You can't have a rotation matrix that rotates all vectors in 3D space such that the angle between the original and rotated vector is 10 degrees. You can get an R that will do this for all vectors in a specific plane, but not all vectors in 3D space. E.g., a vector along the axis of rotation will end up being rotated 0 degrees. Other vectors, in general, will be somewhere between 0 and 10 degrees.
  4 个评论
Walter Roberson
Walter Roberson 2015-6-2
You required that the rotation matrix rotate "any" unit vector from the origin by 10 degrees. That cannot work. There must always be an axis of rotation, and any vector along that axis will be left unchanged.
Liangke Zhao
Liangke Zhao 2015-6-5
Yes indeed. So I turned to choose an axis randomly. Thank you all!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by