compute the unit vector given the angle

조회 수: 35 (최근 30일)
zhang
zhang 2012년 5월 4일
편집: Walter Roberson 2018년 12월 10일
Hi guys,
How to compute the unit vector given the direction? Is there any function in matlab to do this task.
Thanks

답변 (3개)

Walter Roberson
Walter Roberson 2012년 5월 4일
편집: Walter Roberson 2018년 12월 10일
For angle theta in radians,
%[x, y] = pol2cart(1, theta); %-> incorrect
[x, y] = pol2cart(theta, 1); %repaired
  댓글 수: 3
Walter Roberson
Walter Roberson 2012년 5월 4일
Urrr, yes.
Kye Taylor
Kye Taylor 2012년 5월 4일
It's unusual that the inputs to the function don't match the "r-theta" convention that is used so often to identify the coordinate space.

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


Roger Stafford
Roger Stafford 2016년 1월 9일
If vector 'v' points in the desired direction, then do this to make it a unit vector:
v = v/norm(v);

Kye Taylor
Kye Taylor 2012년 5월 4일
Given the angle
theta
in radians (counter-clockwise is positive theta, theta = 0 points in the positive x-direction) your unit vector is
u = [cos(theta),sin(theta)]
  댓글 수: 1
jack
jack 2016년 1월 9일
How can you apply your answer to higher dimensions?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by