help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: modulo 2 pi?


From: Francesco Potortì
Subject: Re: modulo 2 pi?
Date: Wed, 21 Jan 2009 14:23:38 +0100

>If I have two angles 'theta' and 'psi', and I want to compute their
>difference I can simply do
>
>  d = theta - psi;
>
>However, I'd like this result to be in the range [0, 2*pi]. Can I simply
>do
>
>  d = mod (theta - psi, 2*pi);
>
>or will this fail in some cases?

It should not.  It would fail if you used 'rem', but using 'mod' you
should have no problems.

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
(entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]