Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to calculate the quantization step size for a given number of bits.
Signal Processing
step_size = (max_value - min_value) / (2 [1] bits)
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication instead of exponentiation.
Using integer division which may cause incorrect step size.
✗ Incorrect
The quantization step size is calculated by dividing the range by 2 raised to the number of bits.
2fill in blank
mediumComplete the code to compute the quantization error as the difference between the original and quantized signal.
Signal Processing
quant_error = original_signal [1] quantized_signalAttempts:
3 left
💡 Hint
Common Mistakes
Adding signals instead of subtracting.
Multiplying signals which does not represent error.
✗ Incorrect
Quantization error is the difference, so subtract the quantized signal from the original.
3fill in blank
hardFix the error in the code to calculate the mean squared quantization noise.
Signal Processing
mean_noise = sum((quant_error [1] 2)) / len(quant_error)
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication by 2 instead of squaring.
Using addition or subtraction instead of exponentiation.
✗ Incorrect
To square the quantization error, use the exponentiation operator ** 2.
4fill in blank
hardFill both blanks to create a dictionary comprehension that maps signal values to their quantization noise if noise is less than 0.1.
Signal Processing
{value: noise for value, noise in zip(signal, quant_noise) if noise [1][2] 0.1}Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' which selects noise greater than 0.1.
Using '>=' which includes noise greater or equal to 0.1.
✗ Incorrect
We want noise less than or equal to 0.1, so use '<=' operator. The first blank is '<' and the second blank is '=' to form '<='.
5fill in blank
hardFill all three blanks to create a dictionary comprehension that maps squared signal values to their noise if noise is greater than 0.05.
Signal Processing
{value[1]2: noise for value, noise in zip(signal, quant_noise) if noise [2] 0.05 and value [3] 0}Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication instead of exponentiation.
Using '>=' instead of '>' for noise filtering.
Using '>' instead of '<' for value filtering.
✗ Incorrect
Square the value with '**2', filter noise greater than 0.05 with '>', and select values less than 0 with '<'.
