atand and atan2d

38 ビュー (過去 30 日間)
Corey Magaldino
Corey Magaldino 2018 年 11 月 13 日
コメント済み: Star Strider 2018 年 11 月 13 日
I have some motion capture data and I have calculated the vertical angles that participants used when wielding an object (atand(y/x)).
The issue is that if they exceed 90 degrees, atand freaks out.
I want to convert to atan2d to avoid this issue.
So I've been playing with it a bit and here is where I'm at. https://imgur.com/a/gxv8DW5
The red line is atand and the blue line is atan2d.
red = atand(y/x)
blue = atan2d(y,x)
Not sure how to handle these values. The output from atand are the correct angle participants used, how can I get atan2d to output the correct angles, but also capture values outside of the -90:90 degree limit of atand.

採用された回答

Star Strider
Star Strider 2018 年 11 月 13 日
I am not certain what result you want.
Try these utility functions I created for my own use a while ago:
Angles360 = @(a) rem(360+a, 360); % For ‘atan2d’
Angles360a = @(a) rem(180+a, 540); % Maps: [-180,180] —> [0,360]
Result1 = Angles360([-150 180])
Result2 = Angles360a([-150 180])
  2 件のコメント
Corey Magaldino
Corey Magaldino 2018 年 11 月 13 日
I'm trying something similar with the unwrap command that has been working okay.
If I do unwrap(blue) and then add 180 degrees, they seem to overlap with some slight issues at the point of the unwrap. I'll try this out, thanks!
Star Strider
Star Strider 2018 年 11 月 13 日
My pleasure.
The unwrap function is intended to provide continuityfor (typically phase) angles that would otherwise repeat on modulo pi or 180°. My functions map one continuous angle to [0,360], and do not unwrap them.
If my Answer helped you solve your problem, please Accept it!
Please do not close Questions that have Answers.

サインインしてコメントする。

その他の回答 (1 件)

madhan ravi
madhan ravi 2018 年 11 月 13 日
Just a guess try:
blue = atan2d(y/x,x)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by