Virtual Laboratory

Quantization and Coding in Digital Communication Systems

For Undergraduate Electrical and Communication Engineering Students

Theory
Simulation
Procedure
Report Guidelines

Theory

Introduction to Digital Communication

Digital communication involves transmitting information in digital form. The process converts analog signals to digital form through sampling and quantization, then encodes them for transmission.

Quantization

Quantization is the process of mapping continuous amplitude values to a finite set of discrete values. It's a necessary step in analog-to-digital conversion (ADC) where the continuous range of analog signal values is divided into non-overlapping intervals, each represented by a discrete level.

Types of Quantization:

  • Uniform Quantization: Equal step size between quantization levels
  • Non-uniform Quantization: Variable step size (often used in voice coding like μ-law and A-law)
  • Mid-tread Quantizer: Zero is one of the output levels
  • Mid-rise Quantizer: Zero is not an output level

Quantization Error:

The difference between the input signal and quantized output is called quantization error or quantization noise. For a uniform quantizer with step size Δ, the maximum quantization error is ±Δ/2.

Coding

After quantization, each discrete level is assigned a binary code. Pulse Code Modulation (PCM) is the most common method where each quantized sample is represented by an n-bit binary word.

Key Concepts:

  • Bit Rate: Number of bits transmitted per second = Sampling rate × Bits per sample
  • Signal-to-Quantization Noise Ratio (SQNR): SQNR (in dB) ≈ 6.02n + 1.76, where n is the number of bits per sample
  • Companding: Compressing and expanding signal to improve SQNR for small signals
Bits per Sample (n) Number of Levels (L = 2ⁿ) SQNR (dB) Example Applications
4 16 25.8 Telephone quality voice
8 256 49.8 Standard PCM, CD audio
12 4096 73.8 Professional audio
16 65536 98.1 High-fidelity audio

Simulation

Adjust the parameters below to visualize how quantization and coding work with different signal types and parameters.

Simulation Results

Quantization Levels: 8

Step Size (Δ): 0.25 V

Maximum Quantization Error: ±0.125 V

Bit Rate: 60 bps

Estimated SQNR: 19.8 dB

Binary Coding Example (First 5 samples):

Sample 1: 0.87 V → Quantized: 0.875 V → Code: 011
Sample 2: 0.98 V → Quantized: 1.000 V → Code: 100
Sample 3: 0.76 V → Quantized: 0.750 V → Code: 010
Sample 4: 0.45 V → Quantized: 0.500 V → Code: 001
Sample 5: 0.12 V → Quantized: 0.125 V → Code: 000

Laboratory Procedure

Follow these steps to understand quantization and coding through simulation and analysis.

Part A: Understanding Quantization

  1. Set up the simulation with a sine wave of frequency 1 Hz and amplitude 1 V.
  2. Set quantization bits to 3 and observe the number of quantization levels (8 levels).
  3. Calculate the step size (Δ) using the formula: Δ = (Max Amplitude - Min Amplitude) / Number of Levels.
  4. Observe the quantization error by comparing the original signal with the quantized signal.
  5. Increase quantization bits to 4, then 5 and observe how quantization error decreases.
  6. Record the SQNR values for different bit settings and verify with the formula: SQNR ≈ 6.02n + 1.76 dB.

Part B: Understanding Coding

  1. Generate binary codes for each quantization level using the simulation.
  2. Note the relationship
  3. Calculate the bit rate using the formula: Bit Rate = Sampling Rate × Bits per Sample.
  4. Change the sampling rate and observe how it affects the reconstructed signal quality.
  5. Experiment with different signal types (sine, triangle, sawtooth) and observe the quantization effects.

Part C: Advanced Analysis

  1. Determine the minimum sampling rate required for accurate reconstruction (Nyquist rate).
  2. Calculate the bandwidth required for transmitting the digital signal.
  3. Simulate non-uniform quantization by applying a companding function to the signal before quantization.
  4. Compare the performance of uniform vs. non-uniform quantization for signals with high peak-to-average ratio.

Report Writing Guidelines

A well-structured lab report is essential for documenting your findings. Follow these guidelines for your quantization and coding lab report.

Report Structure

  • Title Page: Lab title, your name, course information, date, and instructor's name.
  • Abstract/Summary: Brief overview (100-150 words) of objectives, methods, and key findings.
  • Introduction: Explain the importance of quantization and coding in digital communication systems.
  • Theory Background: Explain sampling theorem, quantization process, types of quantization, coding techniques, and key formulas.
  • Procedure: Document the steps you followed in the simulation, including parameter settings.
  • Results and Analysis: Present your findings with tables, graphs, and calculations. Include:
    • Quantization error vs. number of bits
    • SQNR calculations for different bit resolutions
    • Bit rate calculations
    • Binary coding examples
    • Comparison of different signal types
  • Discussion: Interpret your results, explain observations, and discuss any discrepancies from expected values.
  • Conclusion: Summarize key findings and their implications for digital communication system design.
  • References: Cite textbooks, research papers, or online resources used.
  • Appendices: Include any additional data, code snippets, or detailed calculations.

Tips for Effective Reporting

  • Use clear, labeled figures with captions
  • Number equations and reference them in the text
  • Compare simulation results with theoretical values
  • Discuss practical applications of your findings
  • Proofread for clarity and technical accuracy

Sample Calculations to Include

1. Step Size: Δ = (V_max - V_min) / 2^n

2. Maximum Quantization Error: e_max = ±Δ/2

3. Signal-to-Quantization Noise Ratio: SQNR ≈ 6.02n + 1.76 dB

4. Bit Rate: R = f_s × n (bits per second)

5. Nyquist Rate: f_N = 2 × f_max