How can I rotate a set of points around an axis?

조회 수: 15 (최근 30일)
Jonathan Babitsch
Jonathan Babitsch 2020년 6월 8일
댓글: Jonathan Babitsch 2020년 6월 8일
Hi everybody,
I have a question concerning a mathematical problem that I would like to solve.
If I have a Matrix 8x3, and like every line in the matrix describes a point, how can i rotate all the points in the matrix for example around the z axis?
I have tried it with a rotaionmatrix, but does that work? What does my code need to look like?
I'm sorry I don't really know how to do that. I have the following:
Above is the Code where I calculate the rotation matrix, and here is the set of points I would like to rotate:
Thanks a lot for your replies in advance, I'm glad for any help. I'm new to Matlab so I don't really know how to do this.
Have a nice evening,
Johnny

채택된 답변

James Tursa
James Tursa 2020년 6월 8일
편집: James Tursa 2020년 6월 8일
Arrange your points as column vectors and do a matrix multiply. E.g.,
result = rotmxXYZ * K.';
The result will have your points as column vectors also.
If you really need them in rows, then transpose result, or do this:
result = K * rotmxXYZ';
  댓글 수: 1
Jonathan Babitsch
Jonathan Babitsch 2020년 6월 8일
That was easy, just didn`t pay attention to the rules of matrix multiplication...Thank you very much for your help James! I really appreciate it!
Have a nice day sir!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by