Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Vector quantization encoding

The `VectorQuantizerEncoder`

object performs vector
quantization encoding. The object finds the nearest codeword by computing a distortion based
on Euclidean or weighted Euclidean distance.

To perform vector quantization encoding:

Create the

`dsp.VectorQuantizerEncoder`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

`vqenc = dsp.VectorQuantizerEncoder`

`vqenc = dsp.VectorQuantizerEncoder(Name,Value)`

returns a
vector quantizer encoder System
object™, `vqenc`

= dsp.VectorQuantizerEncoder`vqenc`

. This object finds a zero-based index of the
nearest codeword for each given input column vector.

returns a vector quantizer encoder System
object, `vqenc`

= dsp.VectorQuantizerEncoder(`Name,Value`

)`vqenc`

, with each specified property set to the
specified value.

**For versions earlier than R2016b, use the step
function to run the System object algorithm. The arguments to
step are the object you created, followed by
the arguments shown in this section.**

**For example, y = step(obj,x) and y = obj(x) perform equivalent operations.**

`Index = vqenc(Input)`

`Index = vqenc(Input,Codebook)`

`Index = vqenc(___,Weights)`

`[Index,Codeword] = vqenc(___)`

`[Index,Qerr] = vqenc(___)`

uses the input vector `Index`

= vqenc(___,`Weights`

)`Weights`

to emphasize or de-emphasize certain
input values when calculating the distortion measure. `Weights`

must be
a vector of length equal to the number of rows of `Input`

. This option
is available when the `DistortionMeasure`

property is ```
Weighted
squared error
```

and the `WeightsSource`

property is
`Input port`

.

To use an object function, specify the
System
object as the first input argument. For
example, to release system resources of a System
object named `obj`

, use
this syntax:

release(obj)

This object implements the algorithm, inputs, and outputs described on the Vector Quantizer Encoder block reference page. The object properties correspond to the block parameters.