control.matlab.unwrap

control.matlab.unwrap(angle, period=6.283185307179586)[source]

Unwrap a phase angle to give a continuous curve.

Parameters
  • angle (array_like) – Array of angles to be unwrapped

  • period (float, optional) – Period (defaults to 2*pi)

Returns

angle_out – Output array, with jumps of period/2 eliminated

Return type

array_like

Examples

>>> # Already continuous
>>> theta1 = np.array([1.0, 1.5, 2.0, 2.5, 3.0]) * np.pi
>>> theta2 = ct.unwrap(theta1)
>>> theta2/np.pi                                            
array([1. , 1.5, 2. , 2.5, 3. ])
>>> # Wrapped, discontinuous
>>> theta1 = np.array([1.0, 1.5, 0.0, 0.5, 1.0]) * np.pi
>>> theta2 = ct.unwrap(theta1)
>>> theta2/np.pi                                            
array([1. , 1.5, 2. , 2.5, 3. ])