% INTUNSIGNED converts to an unsigned n-bit integer.
%
%   Y=INTUNSIGNED(X,N) converts the elements of the array X into unsigned
%   N-bit integers. X can be any numeric object, such as a DOUBLE. The
%   values of an INTUNSIGNED range from 0 to 2^N-1.
%   Values outside this range do not saturate on the extremes range,
%   turning around the scale and mapped into de range specified.

function y=intunsigned(x,n)

max=2^n;

y=x-max*floor(x/max);
