pub fn unwrap<T: Float + Clone>(phase_array: &Array<T>) -> Array<T>Expand description
Unwrap phase angles by changing deltas between values to 2*pi complements
This function unwraps a sequence of phase values by adjusting jumps greater than pi to their 2*pi complement. This is useful for continuous phase signals that have been wrapped to the [-pi, pi] range.
§Parameters
phase_array- An array of phase values (in radians)
§Returns
An array with unwrapped phase values
§Examples
use numrs2::math::unwrap;
use numrs2::array::Array;
use std::f64::consts::PI;
// Phase values that jump from near pi to near -pi
let wrapped = Array::from_vec(vec![0.0, 1.0, 2.0, 3.0, -3.0, -2.0, -1.0]);
let unwrapped = unwrap(&wrapped);
// The jump from 3.0 to -3.0 should be unwrapped