# uencode

Quantize and encode floating-point inputs to integer outputs

## Description

quantizes the entries in a multidimensional array of floating-point numbers
`y`

= uencode(`u`

,`n`

)`u`

and encodes them as integers using
2^{n}-level quantization. The output y and the input
`u`

are arrays of the same size. The elements of the output y are
unsigned integers with magnitudes in the range
[0, 2^{n}-1].

maps entries in a multidimensional array of floating-point numbers `y`

= uencode(`u`

,`n`

,`v`

,`'SignFlag'`

)`u`

whose entries have values in the range [`-v,v`

] to an integer output
`y`

. Input entries outside this range are saturated.

## Examples

## Input Arguments

## Output Arguments

## Algorithms

`uencode`

maps the floating-point input value to an integer value determined
by the requirement for 2^{n} levels of quantization. This encoding
adheres to the definition for uniform encoding specified in ITU-T Recommendation G.701. The
input range `[-v,v]`

is divided into 2^{n} evenly
spaced intervals. Input entries in the range `[-v,v]`

are first quantized
according to this subdivision of the input range, and then mapped to one of
2^{n} integers. The range of the output depends on whether or not
you specify that you want signed integers.

The output data types are optimized for the number of bits as shown in the table below.

## References

[1] International Telecommunication Union. *General
Aspects of Digital Transmission Systems: Vocabulary of Digital Transmission
and Multiplexing, and Pulse Code Modulation (PCM) Terms*.
ITU-T Recommendation G.701. March, 1993.

## See Also

**Introduced before R2006a**