unwrap: Unwrap phase angles

View source: R/unwrap.R

unwrapR Documentation

Unwrap phase angles

Description

Unwrap radian phases by adding or subtracting multiples of 2 * pi.

Usage

unwrap(x, tol = pi)

Arguments

x

Input array, specified as a vector or a matrix. If x is a matrix, unwrapping along the columns of x is applied.

tol

Jump threshold to apply phase shift, specified as a scalar. A jump threshold less than pi has the same effect as the threshold pi. Default:

pi

.

Value

Unwrapped phase angle, returned as a vector, matrix, or multidimensional array.

Author(s)

Bill Lash.
Conversion to R by Geert van Boxtel, gjmvanboxtel@gmail.com

Examples

## Define spiral shape.
t <- seq(0, 6 * pi, length.out = 201)
x <- t / pi * cos(t)
y <- t / pi * sin(t)
plot(x, y, type = "l")
## find phase angle
p = atan2(y, x)
plot(t, p, type="l")
## unwrap it
q = unwrap(p)
plot(t, q, type ="l")


gsignal documentation built on Sept. 12, 2024, 6:27 a.m.