Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to calculate the power of the signal array.
Signal Processing
signal_power = sum(signal[1]2) / len(signal)
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' instead of '**' for squaring.
Forgetting to square the signal values.
✗ Incorrect
We use the exponent operator ** to square each element of the signal.
2fill in blank
mediumComplete the code to calculate the noise power from the noise array.
Signal Processing
noise_power = sum(noise[1]2) / len(noise)
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication instead of exponentiation.
Not squaring the noise values.
✗ Incorrect
We square each noise value using **2 to find power.
3fill in blank
hardFix the error in the SNR calculation formula.
Signal Processing
snr = 10 * log10(signal_power [1] noise_power)
Attempts:
3 left
💡 Hint
Common Mistakes
Using subtraction or addition instead of division.
Multiplying signal and noise power.
✗ Incorrect
SNR is the ratio of signal power to noise power, so we divide.
4fill in blank
hardFill both blanks to compute the SNR in decibels using numpy functions.
Signal Processing
snr_db = 10 * np.[1](signal_power [2] noise_power)
Attempts:
3 left
💡 Hint
Common Mistakes
Using natural log
log instead of log10.Multiplying instead of dividing inside the log.
✗ Incorrect
Use np.log10 for base-10 log and divide signal power by noise power.
5fill in blank
hardFill all three blanks to create a dictionary with signal, noise, and SNR values.
Signal Processing
results = {"signal_power": [1], "noise_power": [2], "snr_db": [3]Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect variable names like 'snr' instead of 'snr_db'.
Mixing up signal and noise power variables.
✗ Incorrect
The dictionary keys map to the variables holding the calculated values.
