Challenge - 5 Problems
Inverse FFT Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateOutput of Inverse FFT on a simple frequency array
What is the output of the following Python code that uses inverse FFT to reconstruct a time-domain signal?
Signal Processing
import numpy as np freq_data = np.array([4+0j, 0+0j, 0+0j, 0+0j]) time_signal = np.fft.ifft(freq_data) print(time_signal.real)
Attempts:
2 left
💡 Hint
Recall that inverse FFT converts frequency domain data back to time domain. A single non-zero frequency at zero frequency corresponds to a constant signal.
✗ Incorrect
The frequency array has only the zero frequency component set to 4, which corresponds to a constant time-domain signal with value 1 at all points (since ifft divides by the length).
❓ data_output
intermediateLength of reconstructed signal from partial frequency data
Given a frequency domain array of length 8, what is the length of the time-domain signal after applying inverse FFT?
Signal Processing
import numpy as np freq_data = np.array([1, 0, 0, 0, 0, 0, 0, 0]) time_signal = np.fft.ifft(freq_data) print(len(time_signal))
Attempts:
2 left
💡 Hint
Inverse FFT output length matches the input frequency array length.
✗ Incorrect
The inverse FFT returns a time-domain array with the same length as the input frequency array.
❓ visualization
advancedVisualizing signal reconstruction using inverse FFT
Which option shows the correct plot of the real part of the inverse FFT of the frequency data representing a cosine wave?
Signal Processing
import numpy as np import matplotlib.pyplot as plt freq_data = np.zeros(16, dtype=complex) freq_data[1] = 64 + 0j freq_data[-1] = 64 + 0j signal = np.fft.ifft(freq_data) plt.plot(signal.real) plt.title('Reconstructed Signal') plt.xlabel('Sample Index') plt.ylabel('Amplitude') plt.grid(True) plt.show()
Attempts:
2 left
💡 Hint
Frequency components at indices 1 and -1 correspond to a cosine wave in time domain.
✗ Incorrect
The frequency components at positive and negative first harmonics create a cosine wave with amplitude 8 in the time domain.
🧠 Conceptual
advancedEffect of missing frequency components on inverse FFT reconstruction
If you set all frequency components except the zero frequency to zero before applying inverse FFT, what will the reconstructed time-domain signal look like?
Attempts:
2 left
💡 Hint
The zero frequency component represents the average value of the signal.
✗ Incorrect
Keeping only the zero frequency component means the signal has no variation and is constant at the average value.
🔧 Debug
expertIdentify the error in inverse FFT reconstruction code
What error will occur when running this code snippet?
Signal Processing
import numpy as np freq_data = [1, 2, 3, 4] time_signal = np.fft.ifft(freq_data) print(time_signal)
Attempts:
2 left
💡 Hint
Check if numpy.fft.ifft accepts lists as input.
✗ Incorrect
numpy.fft.ifft automatically converts list input to numpy array internally, so no error occurs.
