Angle function output convention

4 ビュー (過去 30 日間)
Miguel Melnychuk
Miguel Melnychuk 2015 年 3 月 12 日
回答済み: Miguel Melnychuk 2015 年 3 月 12 日
Why does the function 'angle(complex_input)' output values between +pi and -pi radians? Normal convention is 0 to 2*pi. I find this confusing. What am I misunderstanding? Is there a way to convert this? Simply adding pi to the output did not seem to work.

回答 (4 件)

dpb
dpb 2015 年 3 月 12 日
編集済み: dpb 2015 年 3 月 12 日
It is consistent with other computer languages for atan2, etc., so for consistency, I presume, TMW chose to keep it that way instead of being "odd man out".
To convert, add 2pi only for angle < 0

Roger Stafford
Roger Stafford 2015 年 3 月 12 日
a = mod(angle(z),2*pi);

Miguel Melnychuk
Miguel Melnychuk 2015 年 3 月 12 日
That makes sense. Thanks.

Miguel Melnychuk
Miguel Melnychuk 2015 年 3 月 12 日
Thanks very much everyone. This worked for me. I understand a bit better now.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by