Function File: xwrap = wrapTo2Pi (x)

Wraps x into the [0 to 2pi] interval

x: angle in radians (single value, vector or ND matrix).

xwrap: output value(s) in the range [0 .. 2*pi] radians. The interval [0 .. 2*pi] is a closed interval: values equal to zero or negative even multiples of pi are mapped to 0, values equal to an even multiple of pi are mapped to 2*pi.

Example:

wrapTo2Pi ([-2*pi, -pi, 0, pi; 0.1, pi, 4*pi, 5*pi])
ans =
  0.00000   3.14159   0.00000   3.14159
  0.10000   3.14159   6.28319   3.14159

See also: wrapTo180, wrapTo360, wraptoPi.

Package: mapping