L3



APLICAȚIA NR. 7

Studiul fenomenului de cuantizare, în LabVIEW

I. PARTEA TEORETICĂ

An A/D converter has a finite number of bits (or resolution). As a result, continuous amplitude values get represented or approximated by discrete amplitude levels.

The process of converting continuous into discrete amplitude levels is called quantization. This approximation leads to errors called quantization noise.

The input/output characteristic of a 3-bit A/D converter is shown in Figure 1 to see how analog voltage values are approximated by discrete voltage levels.

[pic]

Figure 1: Characteristic of a 3-bit A/D converter: (a) input/output transfer function and (b) additive quantization noise.

A quantization interval depends on the number of quantization or resolution levels, as illustrated in Figure 2. Clearly, the amount of quantization noise generated by an A/D converter depends on the size of the quantization interval.

[pic]

Figure 2: Quantization levels.

More quantization bits translate into a narrower quantization interval and hence into a lower amount of quantization noise.

In Figure 2, the spacing △ between two consecutive quantization levels corresponds to one least significant bit (LSB). Usually, it is assumed that quantization noise is signal independent and is uniformly distributed over –0.5 LSB and 0.5 LSB.

Figure 3 shows the quantization noise of an analog signal quantized by a 3-bit A/D converter.

[pic]

Figure 3: Quantization of an analog signal by a 3-bit A/D converter: (a) output signal and quantization error,(b) histogram of quantization error, and (c) bit stream.

II. PARTEA PRACTICĂ

Let us now build an A/D converter VI to illustrate the quantization effect. An analog signal given by:

[pic]

is considered for this purpose. Note that the maximum and minimum values of the signal fall in the range 0 to 7, which can be represented by 3 bits. On the FP, the quantization error, the histogram of the quantization error, as well as the quantized output are displayed as indicated in Figure 4.

To build the converter BD, as shown in Figure 5, one needs to use the Formula Waveform VI (Functions » Programming » Waveform » Analog Waveform » Waveform Generation » Formula Waveform). The inputs to this VI comprise a string constant specifying the formula, amplitude, frequency, and sampling information.The values of the output waveform, Y component, are extracted with the Get Waveform Components function (Functions » Programming » Waveform » Get Waveform Components).

To exhibit the quantization process, one can use the To Unsigned Byte Integer function (Functions » Programming » Numeric » Conversion » To Unsigned Byte Integer) to convert the double precision signal into an unsigned integer signal.

The resolution of quantization is assumed to be 3 bits, noting that the amplitude of the signal remains between 0 and 7. Values of the analog waveform are replaced by quantized values forming a discretized waveform. This is done by wiring the quantized values to a Build Waveform function while the other properties are kept the same as the analog waveform.

Now the difference between the input and quantized output values can be found by using the Subtract function. This difference represents the quantization error.

Also, the histogram of the quantization error is obtained by using the Create Histogram Express VI (Functions » Express » Signal Analysis » Create Histogram).

Placing this VI brings up a configuration dialog, as shown in Figure 6.

The maximum and minimum quantization errors are 0.5 and –0.5, respectively.

Hence, the number of bins is set to 10 in order to divide the errors between –0.5 and 0.5 into 10 levels. In addition, for the Amplitude Representation option, choose Sample count to generate the histogram. A waveform graph can be created by right-clicking on the Histogram node of the Create Histogram Express VI and choosing Create » Graph Indicator.

Return to the FP and change the property of the graph for a more understandable display of the discrete signal. Add the plot legend to the waveform graph and resize it to display the two signals. Rename the analog signal as Input Signal and the discrete signal as Output Signal.

[pic]

Figure 4: Quantization of an analog signal by a 3-bit A/D converter: output

signal, quantization error, and histogram of quantization error.

[pic]

Figure 5: Quantization of an analog signal by a 3-bit A/D converter.

[pic]

Figure 6: Configuration dialog box of Create Histogram Express VI.

To display the discrete signal, bring up the Properties dialog box by right-clicking and choosing Properties from the shortcut menu. Click the Plots tab and choose the signal plot Output Signal. Then, choose stepwise horizontal, indicated by, from the Plot Interpolation option as the interpolation method. Now, the VI is complete, as shown in Figure 4.

[pic]

Figure 7: Bitstream of 3-bit quantization.

Next, let us build a VI which can analyze the quantized discrete waveform into a bitstream resembling a logic analyzer. For a 3-bit A/D converter, the bitstream can be represented by b3b2b1 in binary format. The discrete waveform and its bit decomposition are shown in Figure 7.

The same analog signal used in the previous example is considered here. The analog signal is generated by a Formula Waveform VI and quantized by using a To Unsigned Byte Integer function. Locate a For Loop to repeat the quantization as many times as the number of samples. This number is obtained by using the Array Size function (Functions » Programming » Array » Array Size).

Wire this number to the Count terminal of the For Loop.

Wiring the input array to the For Loop places a Loop Tunnel on the loop border.

Note that auto-indexing is enabled by default when one inputs an array into a For Loop. With auto-indexing enabled, each element of the input array is passed into the loop one at a time per loop iteration.

In order to obtain a binary bitstream, each value passed into the For Loop is converted into a Boolean array via a Number To Boolean Array function (Functions » Programming » Boolean » Number To Boolean Array). The elements of the Boolean array represent the decomposed bits of the 8-bit integer. The value of a specific bit can be accessed by passing the Boolean array into an Index Array function (Functions » Programming » Array » Index Array) and specifying the bit location with a Numeric Constant. Since the values stored in the array are Boolean, i.e. false or true, they are then converted into 0 and 1, respectively, using the Boolean To (0,1) function (Functions » Programming » Boolean »

Boolean To (0,1)). Data from each bit location are wired out of the For Loop. Note that an array output is created with the auto-indexing being enabled.

As configured in the previous example, the stepwise horizontal interpolation method is used for the waveform graph of the discrete signal. The completed VI is shown in Figure 8.

[pic]

Figure 8: Logic analyzer BD.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download