function xq = linquant( x, x_max, nbits )
% function xq = linquant( x, x_max, nbits )
%
% Simulation of Linear quantizer with exact representation of x==0
%
% x:       input vector to be quantized
% x_max:   quantization range is -x_max ... x_max
% nbits:   number of bits   
% xq:      quantized approximation of x
%
% Author:  Markus Hauenstein
% Date:    26.12.2001
% Contact: www.markus-hauenstein.de
%
dx = x_max/(2^(nbits-1));
xq = dx*sign(x).*round(abs(x)/dx);