# unitquantize

Quantize numeric data using `quantizer` object except numbers within `eps` of `+1`

## Syntax

``y = unitquantize(q,x)``
``[y1,y2,…] = unitquantize(q,x1,x2,…)``

## Description

````y = unitquantize(q,x)` uses the `quantizer` object `q` to quantize numeric data in `x`. `unitquantize` works in the same way as `quantize` except that numbers within `eps``(q)` of `+1` are made exactly equal to `+1`.```

example

````[y1,y2,…] = unitquantize(q,x1,x2,…)` is equivalent to `y1 = unitquantize(q,x1), y2 = unitquantize(q,x2), …` and so forth.```

## Examples

collapse all

Use `unitquantize` with a `quantizer` object to quantize data.

```x = (0.8:.1:1.2)'; q = quantizer('fixed','floor','saturate',[4 3]); y = unitquantize(q,x); z = [x y] e = eps(q)```
```z = 0.8000 0.7500 0.9000 1.0000 1.0000 1.0000 1.1000 1.0000 1.2000 1.0000 e = 0.1250```

`unitquantize` quantizes the elements of `x` except for numbers within `eps` of `+1`.

```x = [1 pi/4]; q = quantizer([8,7]) y1 = quantize(q,x) y2 = unitquantize(q,x)```
```q = DataMode = fixed RoundMode = floor OverflowMode = saturate Format = [8 7] Warning: 1 overflow(s) occurred in the fi quantize operation. y1 = 0.9922 0.7812 y2 = 1.0000 0.7812```

## Input Arguments

collapse all

Data type properties to use for quantization, specified as a `quantizer` object.

Example: ```q = quantizer('fixed','ceil','saturate',[5 4]);```

Data to quantize, specified as a scalar, vector, matrix, multidimensional array, cell array, or structure.

• When `x` is a numeric array, each element of `x` is quantized.

• When `x` is a cell array, each numeric element of the cell array is quantized.

• When `x` is a structure, each numeric field of `x` is quantized.

`unitquantize` does not change nonnumeric elements or fields of `x`, nor does it issue warnings for nonnumeric values. Numbers within `eps``(q)` of `+1` are made exactly equal to `+1`.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `logical` | `struct` | `cell`
Complex Number Support: Yes

Data to quantize (as separate elements), specified as a scalar, vector, matrix, multidimensional array, cell array, or structure.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `logical` | `struct` | `cell`
Complex Number Support: Yes

## Version History

Introduced in R2008a