ADC (Analog to Digital Converter) changes real-world signals into numbers. DAC (Digital to Analog Converter) changes numbers back into real-world signals.
ADC and DAC in signal chain in Signal Processing
digital_signal = ADC(analog_signal) analog_signal = DAC(digital_signal)
ADC converts continuous signals into discrete digital values.
DAC converts digital values back into continuous signals.
# Simulate ADC by sampling an analog sine wave import numpy as np fs = 1000 # Sampling frequency in Hz f = 5 # Signal frequency in Hz t = np.linspace(0, 1, fs, endpoint=False) analog_signal = np.sin(2 * np.pi * f * t) digital_signal = np.round((analog_signal + 1) * 127) # 8-bit ADC simulation
# Simulate DAC by converting digital values back to analog reconstructed_signal = (digital_signal / 127) - 1
This program creates a sine wave as an analog signal, simulates an 8-bit ADC converting it to digital values, then simulates a DAC converting it back to analog. It plots the original and reconstructed signals to show the effect.
import numpy as np import matplotlib.pyplot as plt # Parameters fs = 1000 # Sampling frequency (Hz) f = 5 # Signal frequency (Hz) # Time vector for 1 second t = np.linspace(0, 1, fs, endpoint=False) # Analog signal: sine wave analog_signal = np.sin(2 * np.pi * f * t) # ADC simulation: 8-bit quantization # Map from [-1,1] to [0,255] digital_signal = np.round((analog_signal + 1) * 127).astype(int) # DAC simulation: map back from [0,255] to [-1,1] reconstructed_signal = (digital_signal / 127) - 1 # Plot signals plt.figure(figsize=(10, 6)) plt.plot(t[:100], analog_signal[:100], label='Analog Signal (Original)') plt.step(t[:100], reconstructed_signal[:100], label='Reconstructed Signal (DAC)', where='mid') plt.title('ADC and DAC Signal Chain Simulation') plt.xlabel('Time (seconds)') plt.ylabel('Amplitude') plt.legend() plt.grid(True) plt.show()
ADC and DAC introduce small errors called quantization noise.
Higher bit depth in ADC/DAC means better signal quality.
Sampling frequency must be at least twice the highest signal frequency (Nyquist rate) to avoid errors.
ADC changes real signals into numbers for digital processing.
DAC changes numbers back into real signals for output.
They are key parts of any system that mixes analog and digital signals.
Practice
Solution
Step 1: Understand ADC function
An ADC takes continuous analog signals from the real world and changes them into digital numbers that computers can use.Step 2: Compare options to ADC role
Only Convert real-world analog signals into digital data describes converting analog signals to digital data, which matches the ADC's main role.Final Answer:
Convert real-world analog signals into digital data -> Option DQuick Check:
ADC = Analog to Digital conversion [OK]
- Confusing ADC with DAC
- Thinking ADC amplifies signals
- Assuming ADC stores data
Solution
Step 1: Recall DAC symbol conventions
In signal diagrams, DAC is usually shown as a triangle pointing right with the label 'DAC'.Step 2: Match options to DAC symbol
A triangle pointing right with 'DAC' label matches this description exactly, while others either have wrong direction or label.Final Answer:
A triangle pointing right with 'DAC' label -> Option AQuick Check:
DAC symbol = triangle right + 'DAC' label [OK]
- Confusing ADC and DAC symbols
- Choosing left-pointing triangle for DAC
- Selecting a square shape
analog_signal = [0.1, 0.5, 0.9] bit_depth = 2 max_level = 2**bit_depth - 1 adc_output = [int(x * max_level) for x in analog_signal] print(adc_output)What is the output printed?
Solution
Step 1: Calculate max_level from bit_depth
bit_depth is 2, so max_level = 2^2 - 1 = 3.Step 2: Multiply each analog value by max_level and convert to int
0.1*3=0.3 -> int=0, 0.5*3=1.5 -> int=1, 0.9*3=2.7 -> int=2.Final Answer:
[0, 1, 2] -> Option AQuick Check:
2-bit ADC max level 3, scaled values int = [0,1,2] [OK]
- Confusing max_level calculation
- Rounding instead of flooring
- Misreading bit depth
digital_values = [0, 1, 2, 3] bit_depth = 2 max_level = 2**bit_depth - 1 analog_output = [x / max_level for x in digital_values] print(analog_output)However, the output is incorrect for a 3-bit DAC. What is the error?
Solution
Step 1: Identify bit_depth mismatch
The code uses bit_depth=2 but digital_values go up to 3, which fits 2 bits. For 3-bit DAC, bit_depth should be 3.Step 2: Understand impact on max_level and output
With bit_depth=3, max_level=7, so dividing digital values by 7 scales correctly. Using 3 causes wrong scaling.Final Answer:
bit_depth should be 3, not 2 -> Option CQuick Check:
bit_depth must match DAC bits [OK]
- Changing division to multiplication
- Ignoring bit_depth mismatch
- Assuming digital_values are wrong
Solution
Step 1: Recall the standard resolution formula for an ADC
The voltage resolution (LSB size) is the full-scale voltage divided by 2^n: V_fs / 2^n, where n is the number of bits.Step 2: Apply the formula
Here, V_fs = 5 V, n = 4, so resolution = 5 / 2^4 = 5 / 16 = 0.3125 volts.Step 3: Match to options
5 volts divided by 2^4 = 0.3125 volts exactly matches this formula and value. 5 volts divided by (2^4 - 1) = 0.357 volts incorrectly uses (2^4 - 1) and has a miscalculation (5/15 ≈ 0.333, not 0.357).Final Answer:
5 volts divided by 2^4 = 0.3125 volts -> Option BQuick Check:
Resolution = V_fs / 2^n [OK]
- Dividing by (2^bits - 1) instead of 2^bits
- Miscalculating numerical values like 5/15 ≈ 0.333 as 0.357
- Ambiguous formula parsing in options
Ready to prove it?
Pass the test and this pattern moves unknown
