Digital Signal Processing Reference
In-Depth Information
Status = (['Subtracting decimal equiv of BinWord from sample being quantized'])
diff = DecNum - DecEquivCurrBinWord
if diff < 0;
Status = (['Resetting Bit ',num2str(ctr),' to 0'])
BinWord(1,ctr) = 0;
end
end
Status = (['Final Binary Word:'])
BinOut(1,:) = BinWord;
Err = DecNum - LVBinary2DecimalVec(BinWord);
The following printout occurs after making the call
[BinMat] = LVSuccessAppSingle(1.26,2)
Status = Setting Bit 1 to 1
BinWord=10
DecEquivCurrBinWord = 2
Status = Subtracting decimal equiv of BinWord from sample being quantized
diff = -0.7400
Status = Resetting Bit 1 to 0
Status = Setting Bit 2 to 1
BinWord=01
DecEquivCurrBinWord = 1
Status = Subtracting decimal equiv of BinWord from sample being quantized
diff = 0.2600
Status = Final Binary Word:
BinMat=01
Err = 0.2600
3.10 OFFSET TO INPUT TO REDUCE ERROR
The method of successive approximation as described above always chooses bit weights which add up
to a quantized value which is less than or equal to the actual value of the input signal. As a result, the
approximation of the quantized signal to the actual signal is biased an average of one-half LSB toward
zero, and the maximum quantization error is 1.0 times the LSB.
Example 3.15. Demonstrate that a bias to the input signal of 0.5 LSB away from zero results in a
maximum quantization error of one-half LSB rather than 1.0 LSB.
We present a script that can convert an entire sequence of decimal numbers to binary equivalents,
quantized to a specified number of bits, and where a bias of one-half LSB to the input signal can be
optionally added. This script is not the most efficient one possible; in the exercises below, the reader is
presented with the task of writing a script that will conduct the successive approximation technique simul-
taneously on an entire input sequence, thus eliminating the outer loop, which can make the computation
very slow for long sequences.
function [BinMat,Err] = LVSuccessApp(DecNum,MaxBits,LSBBias)
Search WWH ::




Custom Search