% codeword = uniformQuant(minval,maxval,nbits);
%
% takes as input min and max values and the number of bits
% with which to quantize the values and returns a codeword 
% equal to the mean of the bins.
%
% J. Sabataitis
% Oct. 19, 2000
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function codeword = uniformQuant(minval, maxval, nbits);

nlevels = 2^nbits;
%nlevels

binsize = (maxval-minval)/nlevels;
%binsize

codeword = minval+0.5*binsize:binsize:minval+(nlevels-0.5)*binsize;

