Angle function output convention

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.

Réponses (4)

dpb
dpb le 12 Mar 2015
Modifié(e) : dpb le 12 Mar 2015

2 votes

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
Miguel Melnychuk
Miguel Melnychuk le 12 Mar 2015

0 votes

Thanks very much everyone. This worked for me. I understand a bit better now.

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by