Mapping Toolbox | ![]() ![]() |
Convert normalize angles to lie between - and
Syntax
Description
anglout = npi2pi(anglin) wraps the input angle anglin
to lie on the range -180 to 180 (e.g., 270° is renamed -90°).
anglout = npi2pi(anglin,units
) specifies the angle units with any valid angle units string units
. The default is 'degrees'
.
anglout = npi2pi(anglin,units
,approach
) specifies the approach logic for this wrapping. The approach
string 'exact'
calculates a mathematically precise wrap. 'inward'
and 'outward'
calculate more quickly by shifting the values by an epsilon either toward or away from the origin and performing a trigonometric wrap. The trigonometric wrap is inexact to allow for the fact that different computer math processors might give different (although trigonometrically identical) results (180° or -180°, for example). The offset prevents this.
Examples
See Also
zero22pi |
Normalize angles to lie between 0 and 2![]() |
![]() | northarrow | onem | ![]() |