Challenge - 5 Problems
Signal Energy and Power Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateCalculate energy of a discrete signal
Given the discrete signal x = [2, -1, 3, 0], what is the energy of the signal computed as the sum of squares of its samples?
Signal Processing
import numpy as np x = np.array([2, -1, 3, 0]) energy = np.sum(x**2) print(energy)
Attempts:
2 left
💡 Hint
Energy is sum of squares of each sample value.
✗ Incorrect
Energy = 2^2 + (-1)^2 + 3^2 + 0^2 = 4 + 1 + 9 + 0 = 14.
❓ data_output
intermediateCalculate power of a discrete signal
For the discrete signal x = [1, 2, 3, 4], what is the average power computed as the mean of the squared samples?
Signal Processing
import numpy as np x = np.array([1, 2, 3, 4]) power = np.mean(x**2) print(power)
Attempts:
2 left
💡 Hint
Power is average of squared values.
✗ Incorrect
Power = (1^2 + 2^2 + 3^2 + 4^2) / 4 = (1 + 4 + 9 + 16) / 4 = 30 / 4 = 7.5.
❓ visualization
advancedVisualize energy distribution of a signal
Which plot correctly shows the energy contribution of each sample in the signal x = [1, -2, 2, -1] as bars representing squared values?
Signal Processing
import matplotlib.pyplot as plt import numpy as np x = np.array([1, -2, 2, -1]) energy_per_sample = x**2 plt.bar(range(len(x)), energy_per_sample) plt.xlabel('Sample Index') plt.ylabel('Energy Contribution') plt.title('Energy per Sample') plt.show()
Attempts:
2 left
💡 Hint
Energy per sample is square of sample value, so negative values become positive.
✗ Incorrect
Energy per sample = [1^2, (-2)^2, 2^2, (-1)^2] = [1, 4, 4, 1].
🧠 Conceptual
advancedEnergy vs Power of signals
Which statement correctly describes the difference between energy and power signals?
Attempts:
2 left
💡 Hint
Energy signals have total energy finite but power zero; power signals have finite power but infinite energy.
✗ Incorrect
Energy signals: total energy finite, average power zero. Power signals: total energy infinite, average power finite.
🔧 Debug
expertIdentify error in power calculation code
What error will occur when running this code to calculate power of signal x = [1, 2, 3]?
import numpy as np
x = [1, 2, 3]
power = np.mean(x**2)
print(power)
Signal Processing
import numpy as np x = [1, 2, 3] power = np.mean(np.array(x)**2) print(power)
Attempts:
2 left
💡 Hint
Check the data type of x and if it supports element-wise power operation.
✗ Incorrect
x is a list, and lists do not support the ** operator element-wise; numpy arrays do.
