This is where navigation should be.

UQUANT - Simulate uniform quantization

Usage

x=uquant(x);
x=uquant(x,nbits,xmax,...);

Description

uquant(x,nbits,xmax) simulates the effect of uniform quantization of x using nbits bits. The output is simply x rounded to \(2^{nbits}\) different values. The xmax parameters specify the maximal value that should be quantifiable.

uquant(x,nbits) assumes a maximal quantifiable value of 1.

uquant(x) additionally assumes 8 bit quantization.

uquant takes the following flags at the end of the input arguments:

'nbits' Number of bits to use in the quantization. Default is 8.
'xmax' Maximal quantifiable value. Default is 1.
's' Use signed quantization. This assumes that the signal has a both positive and negative part. Useful for sound signals. This is the default.
'u' Use unsigned quantization. Assumes the signal is positive. Negative values are silently rounded to zero. Useful for images.

If this function is applied to a complex signal, it will be applied to the real and imaginary part separately.