Bird
Raised Fist0
Signal Processingdata~20 mins

Even and odd signal decomposition in Signal Processing - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Signal Decomposition Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate
2:00remaining
Output of even and odd decomposition code
What is the output of the following Python code that decomposes a discrete signal into its even and odd parts?
Signal Processing
import numpy as np
x = np.array([1, 2, 3, 4, 5])
n = np.arange(-2, 3)
x_rev = x[::-1]
x_even = 0.5 * (x + x_rev)
x_odd = 0.5 * (x - x_rev)
print('Even part:', x_even)
print('Odd part:', x_odd)
A
Even part: [3. 3. 3. 3. 3.]
Odd part: [2. 1. 0. -1. -2.]
B
Even part: [1. 2. 3. 4. 5.]
Odd part: [0. 0. 0. 0. 0.]
C
Even part: [3. 3. 3. 3. 3.]
Odd part: [-2. -1. 0. 1. 2.]
D
Even part: [5. 4. 3. 2. 1.]
Odd part: [0. 0. 0. 0. 0.]
Attempts:
2 left
💡 Hint
Remember the even part is (x[n] + x[-n]) / 2 and the odd part is (x[n] - x[-n]) / 2.
❓ data_output
intermediate
1:30remaining
Number of zero elements in odd part
Given the signal x = [4, 7, 10, 7, 4], how many zero elements are in its odd part after decomposition?
Signal Processing
import numpy as np
x = np.array([4, 7, 10, 7, 4])
x_rev = x[::-1]
x_odd = 0.5 * (x - x_rev)
zero_count = np.sum(x_odd == 0)
print(zero_count)
A5
B3
C0
D1
Attempts:
2 left
💡 Hint
Check if the signal is symmetric or not.
❓ visualization
advanced
2:30remaining
Plot even and odd parts of a signal
Which option shows the correct matplotlib code to plot the original signal and its even and odd parts on the same graph with clear labels?
Signal Processing
import numpy as np
import matplotlib.pyplot as plt
x = np.array([1, 3, 5, 3, 1])
x_rev = x[::-1]
x_even = 0.5 * (x + x_rev)
x_odd = 0.5 * (x - x_rev)
n = np.arange(-2, 3)
A
plt.plot(n, x, label='Original')
plt.plot(n, x_even, label='Even')
plt.plot(n, x_odd, label='Odd')
plt.legend()
plt.show()
B
plt.plot(n, x, label='Original')
plt.plot(n, x_even)
plt.plot(n, x_odd)
plt.legend()
plt.show()
C
plt.plot(x, label='Original')
plt.plot(x_even, label='Even')
plt.plot(x_odd, label='Odd')
plt.legend()
plt.show()
D
plt.plot(n, x_even, label='Even')
plt.plot(n, x_odd, label='Odd')
plt.plot(n, x, label='Original')
plt.legend()
plt.show()
Attempts:
2 left
💡 Hint
Use the same x-axis values for all plots and include labels for all lines.
🧠 Conceptual
advanced
1:30remaining
Properties of even and odd signals
Which statement about even and odd signals is true?
AThe product of an even and an odd signal is always an odd signal.
BThe product of two even signals is an even signal.
CThe sum of an even and an odd signal is always an even signal.
DThe sum of two odd signals is always an even signal.
Attempts:
2 left
💡 Hint
Recall how evenness and oddness behave under addition and multiplication.
🔧 Debug
expert
2:00remaining
Identify error in signal decomposition code
What error will the following code produce when decomposing a signal into even and odd parts? import numpy as np x = np.array([1, 2, 3, 4]) n = np.arange(4) x_even = 0.5 * (x + x[-n]) x_odd = 0.5 * (x - x[-n]) print(x_even) print(x_odd)
ATypeError: bad operand type for unary -: 'numpy.ndarray'
BIndexError: arrays used as indices must be of integer (or boolean) type
CValueError: operands could not be broadcast together with shapes (4,) (0,)
DNo error, prints even and odd parts correctly
Attempts:
2 left
💡 Hint
Check the use of the unary minus operator on an array.

Practice

(1/5)
1.

What is the main property of an even signal x(t) in signal processing?

easy
A. It satisfies x(t) = -x(-t) for all t.
B. It has no negative values.
C. It is always zero at t=0.
D. It satisfies x(t) = x(-t) for all t.

Solution

  1. Step 1: Recall definition of even signal

    An even signal is symmetric about zero, meaning the value at t equals the value at -t.
  2. Step 2: Apply the property to the signal

    This means x(t) = x(-t) for every time t.
  3. Final Answer:

    It satisfies x(t) = x(-t) for all t. -> Option D
  4. Quick Check:

    Even signal = x(t) = x(-t) [OK]
Hint: Even signals mirror values at positive and negative times [OK]
Common Mistakes:
  • Confusing even with odd signal definitions
  • Thinking even signals must be zero at t=0
  • Assuming even signals cannot have negative values
2.

Which of the following is the correct formula to find the odd part x_o(t) of a signal x(t)?

easy
A. x_o(t) = (x(t) + x(-t)) / 2
B. x_o(t) = (x(t) - x(-t)) / 2
C. x_o(t) = x(t) * x(-t)
D. x_o(t) = x(t) / x(-t)

Solution

  1. Step 1: Recall formula for odd part of a signal

    The odd part is defined as half the difference between the signal and its time-reversed version: x_o(t) = (x(t) - x(-t)) / 2.
  2. Step 2: Verify the formula matches the odd signal property

    This formula ensures x_o(-t) = -x_o(t), which is the odd signal condition.
  3. Final Answer:

    x_o(t) = (x(t) - x(-t)) / 2 -> Option B
  4. Quick Check:

    Odd part = (x(t) - x(-t))/2 [OK]
Hint: Odd part uses subtraction of reversed signal, then divide by 2 [OK]
Common Mistakes:
  • Using addition instead of subtraction for odd part
  • Multiplying signals instead of subtracting
  • Dividing by wrong number or not dividing at all
3.

Given a discrete signal x = [2, 3, 4, 3, 2] indexed from -2 to 2, what is the even part x_e of this signal?

Use the formula x_e[n] = (x[n] + x[-n]) / 2.

medium
A. [2, 3, 4, 3, 2]
B. [2, 3.5, 4, 3.5, 2]
C. [2, 3, 4, 4, 2]
D. [2, 3.5, 4, 3, 2]

Solution

  1. Step 1: Identify signal values and indices

    Signal x indexed from -2 to 2 is: x[-2]=2, x[-1]=3, x[0]=4, x[1]=3, x[2]=2.
  2. Step 2: Calculate even part using formula

    Calculate each x_e[n] = (x[n] + x[-n]) / 2: - n=-2: (x[-2]+x[2])/2 = (2+2)/2=2 - n=-1: (x[-1]+x[1])/2 = (3+3)/2=3 - n=0: (x[0]+x[0])/2 = (4+4)/2=4 - n=1: (x[1]+x[-1])/2 = (3+3)/2=3 - n=2: (x[2]+x[-2])/2 = (2+2)/2=2 But note the signal is symmetric, so values are same as original except at n=1 and n=-1 where average is 3.
  3. Final Answer:

    [2, 3, 4, 3, 2] -> Option A
  4. Quick Check:

    Even part averages signal and its mirror [OK]
Hint: Average signal values at n and -n for even part [OK]
Common Mistakes:
  • Not averaging values correctly
  • Mixing indices n and -n
  • Using odd part formula instead
4.

Consider the Python code below to compute the odd part of a signal x:

def odd_part(x):
    return [(x[i] - x[-i]) / 2 for i in range(len(x))]

What is the main error in this code?

medium
A. The range should start from 1, not 0.
B. The formula uses addition instead of subtraction.
C. Indexing with negative indices -i is incorrect for this context.
D. The division by 2 is missing.

Solution

  1. Step 1: Understand indexing in Python lists

    Python negative indices count from the end, so -i does not correspond to -n time index but to list end positions.
  2. Step 2: Identify correct indexing for signal symmetry

    For signal indexed from negative to positive, indexing must map i to -i properly, which this code does not do because list indices are 0-based and -i accesses wrong elements.
  3. Final Answer:

    Indexing with negative indices -i is incorrect for this context. -> Option C
  4. Quick Check:

    Python negative indices ≠ signal negative time [OK]
Hint: Python negative indices count from list end, not negative time [OK]
Common Mistakes:
  • Assuming -i indexes negative time correctly
  • Ignoring zero-based indexing
  • Confusing addition/subtraction in formula
5.

You have a signal x(t) = t^3 + 2t. Decompose it into even and odd parts. What is the even part x_e(t)?

hard
A. x_e(t) = 0
B. x_e(t) = t^3
C. x_e(t) = 2t
D. x_e(t) = t^3 + 2t

Solution

  1. Step 1: Identify even and odd nature of terms

    The term t^3 is an odd function because (-t)^3 = -t^3. The term 2t is also odd because 2(-t) = -2t.
  2. Step 2: Calculate even part using formula

    Even part is x_e(t) = (x(t) + x(-t)) / 2. Substitute: x_e(t) = (t^3 + 2t + (-t)^3 + 2(-t)) / 2 = (t^3 + 2t - t^3 - 2t) / 2 = 0.
  3. Final Answer:

    x_e(t) = 0 -> Option A
  4. Quick Check:

    Sum of odd functions is odd, so even part is zero [OK]
Hint: Sum of odd functions has zero even part [OK]
Common Mistakes:
  • Assuming polynomial terms are even by default
  • Mixing odd and even function properties
  • Forgetting to apply formula correctly
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