필터 지우기
필터 지우기

unit vector rotation matrix

조회 수: 11 (최근 30일)
Eivind
Eivind 2011년 9월 26일
Hello! I am new to matlab, and so I have to ask stupid questions.... I am looking for the correct syntax for setting up a geometric vector rotation matrix that I stupidly thought would look something like this: f(x)= [cosX sinx 0; -sinX cosX 0; 0 0 1], where this is the matrix for the Z - axis, and X is the angle. I guess I have to define variables first , but here I am clueless when it comes to matlab. Can someone help me out here ? I am having a hard time with this as I am used to all the C++ syntax I usually deal with. I appreciate any help on the matter :-)
  댓글 수: 1
Andrei Bobrov
Andrei Bobrov 2011년 9월 26일
http://en.wikipedia.org/wiki/Rotation_matrix

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

채택된 답변

UJJWAL
UJJWAL 2011년 9월 26일
Hi, No question is a stupid question. If you are looking to rotate an object then in that case you can do so more easily with the rotate function. Look for it in the MATLAB help. It is much more easier. In case you dont figure it out or you want something else then reply back. I will get back to you.
Happy to Help
UJJWAL

추가 답변 (1개)

Jan
Jan 2011년 9월 26일
Using SIN and COS is equivalent to C++:
x = 0.1; % Angle in radians
R = [cos(x), sin(x), 0; -sin(x), cos(x), 0; 0, 0, 1];
v = rand(3, 1); % Test vector
vR = R * v; % Matrix multiplication
An common method to solve such questions is asking Google for "Matlab rotation matrix".
  댓글 수: 1
Eivind
Eivind 2011년 9월 27일
Thank you very much for your answer. I was going to "accept" both answers I got here but then realized I could only accept 1. Sorry for that.

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

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by