## 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")
Run the code above in your browser using DataLab