Communications Toolbox    

Companding a Signal

In certain applications, such as speech processing, it is common to use a logarithm computation, called a compressor, before quantizing. The inverse operation of a compressor is called an expander. The combination of a compressor and expander is called a compander.

The compand function supports two kinds of companders: µ-law and A-law companders. Its reference page lists both compressor laws.

Example: A µ-Law Compander

The code below quantizes an exponential signal in two ways and compares the resulting mean square distortions. First, it uses the quantiz function with a partition consisting of length-one intervals. In the second trial, compand implements a µ-law compressor, quantiz quantizes the compressed data, and finally compand expands the quantized data. The output shows that the distortion is smaller for the second scheme. This is because equal-length intervals are well suited to the logarithm of sig, but not well suited to sig itself.


  Optimizing DPCM Parameters Arithmetic Coding