You are on page 1of 3

University of Hartford

ECE 382 - Spring 2019


Unit 3 - Quantization in Time and Space

Part 1 — Quantization in Time


When analog data is sampled, there is always a possibility of aliasing. The
purpose of this part of Unit 3 is to investigate this aliasing.
1. Create a 50 point sequence with the index i = 0 to 49. Let
 
f
x(i) = 6.35 cos 2π i
fs

where fs = 8kHz.
2. Letting f = 650 Hz, Output the sequence as a graph and a table.
3. Rerun your vi when f = 7.35 kHz, 8.65 kHz, 16.65 kHz, and 23.35 kHz.
If you are clever, you can output all the data in separate columns of the same
table.
4. Modify your .vi to output to a spreadsheet with the data in columns. The
first column should be the index (i.e. 0 to 49). After running your .vi, bring
the output data into a spreadsheet program like Excel, LibreOfficeCalc, etc to
show the exporting is correct. You only need to show this for 1 frequency.
5. In your report describe the similarities/differences among your results. How
are these results explained by the sampling theorem? Why or why not?
6. Find one additional frequency between 1 kHz and 50 kHz that generates the
same samples. Explain why in your report.
6. Rerun all the frequencies from steps 2 & 3 when when fs = 16 kHz. What
happens and why? (You need only to put your data table and explanation in
your report for this item).

1
Part 2. — Quantization in Space
When analog data is converted into digital values by a digital-to-analog
converter, the converter maps a range of values into a single value. For example,
if the converter was a decimal converter to 1 decimal place accuracy, a measured
voltage of 5.63 V recorder would be converted to 5.6 V . The converted value
is, thus, an approximation of the real value.
The purpose of this part is to investigate this quantization effect and help
understand its implications when an analog signal is converted to its digitally
sampled equivalent.
You will write .vis that calculate each step in Parts 2a and 2b.

Part 2a — Decimal quantization


1. Create a 50 point sequence for i = 0 to 49. Let
  
i i
7.95 N/2 − 1 cos 2π N/5 Birthday — January, April, May, August




September, December

x(i) = 
i
  
i
7.95 1 − N/2 − 1 sin 2π N/5 Birthday — February, March, June, July,




October, November

2. Find the quantized sequence to 1 decimal place as follows: Let

xq (i) = .1 ∗ Whole Number Part of (x(i) ∗ 10)

(Truncate decimal part of x(i) ∗ 10 to get Whole Number Part, then divide by
10. — One way in Labview is to use [Round to −∞] in the Numeric tool pallet.
For example if a value of x is 7.572 then the value of xq would be 7.5
3. Plot x(i) and xq (i) vs i on the same waveform graph. (Hint: Use merge
signals and different colors for each plot.)
4. Create the error sequence, which is the difference between the actual value
and the quantized value.
xe (i) = x(i) − xq (i)
5. Plot xe (i) vs i on a separate waveform graph as just points.
6. Calculate the normalized average signal power, which is the power assuming
that x is a voltage is measured across a 1Ω resistor.
49
1 X 2
Psig = x (i)
50 i=0

(Hint: Outside the loop, pass the array through the x2 function. — It’s poly-
morphc so that there’s no need to worry about data type. — then use the Σ
function to sum the array elements. - Also, if you are clever, you can write the
code so that you do not need to know apriori the number of elements in the
array. - Think about the Unit 3 Lecture.) Output to an indicator.
7. Calculate the normalized average quantized signal power. Compare the
normalized average quantized signal power to the normalized average signal

2
power
49
1 X 2
Pqsig = x (i)
50 i=0 q
Output to an indicator.
8. Calculate the normalized average noise power due to quantization error.
49
1 X 2
Pn = x (i)
50 i=0 e

Output to an indicator.
9. Calculate the signal-to-noise ratio in both numeric and dB units
   
Psig Psig
(S/N )numeric = (S/N )dB = 10 log
Pn Pn

Output to an indicator.
10. Calculate the average error
49
1 X
< xe >= xe (i)
50 i=0

Output to an indicator.

Part 2b — Power of 2 converter


Most analog-to-digital converters are not decimal, but convert the analog
signal into a digital signal with M steps where M is a power of 2, i.e. M = 2m
where m is the number of bits of the A/D Converter. The size of each step is
Vstep , where Vstep = max voltage/M
Let m be a control on the Front Panel of your vi. Let the max voltage, Vmax =
10 V
Use the 50 point sequence you created in Part2a
Repeat steps 3, 4, 5, 6, 7, 8, 9, and 10 from Part 2a. (making appropriate
changes to account for the different stepsize).
Run your .vi for m = 6, 8, 10, 12, and 16 bits.

You might also like