control.unwrap

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

Unwrap a phase angle to give a continuous curve.

Parameters
anglearray_like

Array of angles to be unwrapped.

periodfloat, optional

Period (defaults to 2 pi).

Returns
angle_outndarray

Output array, with jumps of period/2 eliminated.

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. ])