%% Decode Sequence
% Note: If you are using R2016a or an earlier release, replace each call to the object with the equivalent step syntax. For example, obj(x) becomes step(obj,x).

ue = dsp.UniformEncoder;
ue.PeakValue = 2;
ue.NumBits = 4;
ue.OutputDataType = 'Signed integer';
x = (0:0.25:2)'; % Create an input sequence
ud = dsp.UniformDecoder;
ud.PeakValue = 2;
ud.NumBits = 4;
x_encoded = ue(x);

%
% Check that the last element has been saturated.

x_decoded = ud(x_encoded);

% Copyright 2012 The MathWorks, Inc.