%% Unwrap input phase data
% Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

phUnwrap = dsp.PhaseUnwrapper;
p = [0 2/5 4/5 -4/5 -2/5 0 2/5 4/5 -4/5 -2/5 0 2/5 ...
    4/5 -4/5, -2/5]*pi;
y = phUnwrap(p');
figure,stem(p); hold
stem(y, 'r');
legend('Input (blue)','Unwrapped data (red)');
hold off;

% Copyright 2012 The MathWorks, Inc.