Bird
Raised Fist0
Signal Processingdata~20 mins

Signal energy and power in Signal Processing - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Signal Energy and Power Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate
2:00remaining
Calculate 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)
A10
B14
C6
D9
Attempts:
2 left
💡 Hint
Energy is sum of squares of each sample value.
❓ data_output
intermediate
2:00remaining
Calculate 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)
A7.5
B5.0
C3.5
D10.0
Attempts:
2 left
💡 Hint
Power is average of squared values.
❓ visualization
advanced
3:00remaining
Visualize 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()
ABar heights: [1, 4, 4, 1]
BBar heights: [1, -2, 2, -1]
CBar heights: [1, 2, 2, 1]
DBar heights: [1, 8, 8, 1]
Attempts:
2 left
💡 Hint
Energy per sample is square of sample value, so negative values become positive.
🧠 Conceptual
advanced
2:00remaining
Energy vs Power of signals
Which statement correctly describes the difference between energy and power signals?
AEnergy signals have zero energy and zero power; power signals have infinite energy and power.
BEnergy signals have infinite energy and finite average power; power signals have finite energy and zero average power.
CEnergy signals and power signals both have finite energy and power.
DEnergy signals have finite energy and zero average power; power signals have infinite energy and finite average power.
Attempts:
2 left
💡 Hint
Energy signals have total energy finite but power zero; power signals have finite power but infinite energy.
🔧 Debug
expert
2:00remaining
Identify 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)
AValueError: operands could not be broadcast together
BNameError: name 'np' is not defined
CTypeError: unsupported operand type(s) for ** or pow(): 'list' and 'int'
DNo error, prints 4.666666666666667
Attempts:
2 left
💡 Hint
Check the data type of x and if it supports element-wise power operation.

Practice

(1/5)
1. What does the energy of a signal represent in signal processing?
easy
A. The frequency content of the signal
B. The average strength of the signal at a single point
C. The total strength of the signal over all time
D. The duration of the signal

Solution

  1. Step 1: Understand the definition of signal energy

    Energy is the sum of the squared signal values over time, representing total strength.
  2. Step 2: Compare with other options

    Average strength relates to power, frequency content is different, and duration is time length.
  3. Final Answer:

    The total strength of the signal over all time -> Option C
  4. Quick Check:

    Energy = total signal strength [OK]
Hint: Energy sums signal strength over time, not average [OK]
Common Mistakes:
  • Confusing energy with power
  • Thinking energy measures frequency
  • Assuming energy is signal duration
2. Which of the following formulas correctly calculates the energy \(E\) of a discrete signal \(x[n]\) with \(N\) samples?
easy
A. \(E = \frac{1}{N} \sum_{n=0}^{N-1} |x[n]|\)
B. \(E = \max(|x[n]|)\)
C. \(E = \sum_{n=0}^{N-1} x[n]\)
D. \(E = \sum_{n=0}^{N-1} |x[n]|^2\)

Solution

  1. Step 1: Recall energy formula for discrete signals

    Energy is the sum of squared magnitudes of signal samples over all N points.
  2. Step 2: Evaluate each option

    \(E = \sum_{n=0}^{N-1} |x[n]|^2\) matches the energy formula. \(E = \frac{1}{N} \sum_{n=0}^{N-1} |x[n]|\) is average magnitude, C is sum without squaring, D is max value.
  3. Final Answer:

    \(E = \sum_{n=0}^{N-1} |x[n]|^2\) -> Option D
  4. Quick Check:

    Energy = sum of squares [OK]
Hint: Energy sums squared values, not averages or max [OK]
Common Mistakes:
  • Using average instead of sum
  • Not squaring the signal values
  • Taking max instead of sum
3. Consider the discrete signal \(x = [2, -1, 3, 0]\). What is the energy of this signal?
medium
A. 14
B. 6
C. 4
D. 10

Solution

  1. Step 1: Square each element of the signal

    Squares: \(2^2=4\), \((-1)^2=1\), \(3^2=9\), \(0^2=0\).
  2. Step 2: Sum the squared values

    Sum = 4 + 1 + 9 + 0 = 14.
  3. Final Answer:

    14 -> Option A
  4. Quick Check:

    Energy = 4+1+9+0 = 14 [OK]
Hint: Square each value, then add all [OK]
Common Mistakes:
  • Forgetting to square negative values
  • Adding values without squaring
  • Miscounting elements
4. The following Python code attempts to calculate the power of a signal \(x = [1, 2, 3, 4]\). What is the error?
import numpy as np
x = [1, 2, 3, 4]
power = np.sum(x**2) / len(x)
print(power)
medium
A. Cannot use ** operator on list directly
B. Division by zero error
C. np.sum is not a function
D. len(x) returns wrong length

Solution

  1. Step 1: Identify the data type of x

    x is a Python list, which does not support element-wise power with ** operator.
  2. Step 2: Understand numpy operations on lists

    To use ** on elements, x must be a numpy array, not a list.
  3. Step 3: Correct code would convert list to array first

    Use x = np.array(x) before power calculation.
  4. Final Answer:

    Cannot use ** operator on list directly -> Option A
  5. Quick Check:

    List ** 2 causes error [OK]
Hint: Convert list to numpy array before power ops [OK]
Common Mistakes:
  • Trying to square list directly
  • Ignoring data type errors
  • Assuming len(x) causes error
5. A continuous-time signal \(x(t)\) has infinite duration but finite average power. Which statement is true about its energy and power?
hard
A. Energy is finite, power is infinite
B. Energy is infinite, power is finite
C. Both energy and power are infinite
D. Both energy and power are zero

Solution

  1. Step 1: Recall definitions for infinite duration signals

    Signals with infinite duration and finite average power have infinite energy because energy sums over all time.
  2. Step 2: Understand power for such signals

    Power is average energy per unit time, so it can be finite even if total energy is infinite.
  3. Step 3: Match statements with definitions

    Energy is infinite, power is finite correctly states energy infinite and power finite.
  4. Final Answer:

    Energy is infinite, power is finite -> Option B
  5. Quick Check:

    Infinite duration + finite power = infinite energy [OK]
Hint: Infinite duration signals have infinite energy, finite power [OK]
Common Mistakes:
  • Confusing energy and power for infinite signals
  • Assuming finite energy for infinite duration
  • Mixing definitions of energy and power
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard