%% Use udecode to Decode Integers
% Create a vector of 8-bit signed integers. Decode with three bits.

u = int8([-1 1 2 -5]);
ysat = udecode(u,3)

%
% Notice the last entry in u saturates to 1, the default peak input magnitude. Change the peak input magnitude to 6.

ysatv = udecode(u,3,6)

%
% The last input entry still saturates. Wrap the overflows.

ywrap = udecode(u,3,6,'wrap')

%
% Add more quantization levels.

yprec = udecode(u,5)

% Copyright 2012 The MathWorks, Inc.