フィルターのクリア

Determing "turning angle" of 3 points on a matrix

1 回表示 (過去 30 日間)
Stephanie Diaz
Stephanie Diaz 2018 年 11 月 9 日
回答済み: KSSV 2018 年 11 月 9 日
I am simulating movement of a bot on a matrix and keep track of its x and y coordinates. For every current position, I need to calculate the "turning angle" between the bot's current position and every possible new position (x,y coordinate) on the matrix that it can "move" to. I have attached a figure depicting what a turning angle is, but basically, it is the angle formed between the direction of the current movement and the new position. Let's say the red dot is (x1,y1), the blue dot is the current position (x2,y2), and the yellow dot is the potential new position (x3,y3). How can I determine this angle? I would need to find the angle for all possible new positions, but I can probably figure it out if I know how to do it for one.

回答 (1 件)

KSSV
KSSV 2018 年 11 月 9 日
Use dot product.
theta = acos(dot(a,b)/(norm(a)*norm(b)) ;
where a and b are you position vectors.

カテゴリ

Help Center および File ExchangeGeneral Applications についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by