Wolfram Function Repository
Instantuse addon functions for the Wolfram Language
Function Repository Resource:
Remove phase jumps from phase angle data
ResourceFunction["PhaseUnwrap"][list] removes phase jumps in consecutive elements of list by adding ±n 2π for jumps that are larger than the default tolerance of π. 

ResourceFunction["PhaseUnwrap"][list,τ] removes phase jumps in consecutive elements of list by adding ±n τ for jumps that are larger than the default tolerance of τ/2. 

ResourceFunction["PhaseUnwrap"][list,τ,tol] removes phase jumps in consecutive elements of list by adding ±n τ for jumps that are larger than the tolerance tol. 
α  uses the tolerance α 
Scaled [ α ]  uses a tolerance of α τ 
Remove the discontinuity in the phase:
In[1]:= 

Out[3]= 

Correct phase jumps in a list of phase angles measured in degrees:
In[4]:= 

Out[6]= 

Supply a stricter tolerance:
In[7]:= 

Out[9]= 

Supply a tolerance as a scaled version of the modulus:
In[10]:= 

Out[12]= 

Jumps of multiple times the modulus τ are also removed:
In[13]:= 

Out[15]= 

Data measured from an angular encoder on a shaft:
In[16]:= 

Out[17]= 

Unwrap data to get the absolute angle of the shaft:
In[18]:= 

Out[18]= 

PhaseUnwrap is the opposite of Mod for time series of data:
In[19]:= 

Out[22]= 

If the tolerance is too high, steep parts of the function cannot be reconstructed, resulting in partial removal of the discontinuities:
In[23]:= 

Out[26]= 

Show some modulated data:
In[27]:= 

Out[28]= 

Interactively change the tolerance. For a scaled tolerance of 1, the original signal is returned:
In[29]:= 

Out[29]= 

Apply it to twodimensional data by doing rowbyrow unwrapping. First create some data:
In[30]:= 

Out[31]= 

Modulate the data:
In[32]:= 

Out[33]= 

Reconstruct the data:
In[34]:= 

Out[37]= 

Check that they are the same within machine precision:
In[38]:= 

Out[38]= 

Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License