Challenge - 5 Problems
IIR Filter Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of Butterworth filter coefficients
What is the output of the following code that designs a 3rd order Butterworth lowpass filter with cutoff frequency 0.4 (normalized) and prints the numerator coefficients?
SciPy
from scipy.signal import butter b, a = butter(3, 0.4, btype='low') print(b)
Attempts:
2 left
💡 Hint
Recall that butter() returns numerator and denominator coefficients of the filter.
✗ Incorrect
The butter function with order 3 and cutoff 0.4 returns numerator coefficients approximately equal to [0.0181, 0.0543, 0.0543, 0.0181]. Other options are incorrect values.
❓ data_output
intermediate2:00remaining
Number of zeros in Chebyshev Type I filter numerator
After designing a 4th order Chebyshev Type I highpass filter with 1 dB ripple and cutoff frequency 0.3 (normalized), how many zeros does the numerator polynomial have?
SciPy
from scipy.signal import cheby1 b, a = cheby1(4, 1, 0.3, btype='high') print(len(b) - 1)
Attempts:
2 left
💡 Hint
The numerator polynomial degree equals the filter order for IIR filters.
✗ Incorrect
The numerator coefficients array length is order + 1, so zeros count is 4 for a 4th order filter.
🔧 Debug
advanced2:00remaining
Identify the error in filter design code
What error does the following code raise when trying to design a Butterworth bandpass filter with cutoff frequencies 0.2 and 0.5?
SciPy
from scipy.signal import butter b, a = butter(3, [0.2, 0.5], btype='bandpass')
Attempts:
2 left
💡 Hint
Check the valid filter types and cutoff frequency ranges for butter().
✗ Incorrect
No error occurs because 'bandpass' is a valid btype for designing bandpass filters, and the cutoff frequencies [0.2, 0.5] satisfy 0 < 0.2 < 0.5 < 1 and are strictly increasing.
❓ visualization
advanced2:00remaining
Frequency response plot of Chebyshev Type I filter
Which option correctly plots the frequency response magnitude (in dB) of a 5th order Chebyshev Type I lowpass filter with 0.5 normalized cutoff and 0.5 dB ripple?
SciPy
import matplotlib.pyplot as plt import numpy as np from scipy.signal import cheby1, freqz b, a = cheby1(5, 0.5, 0.5, btype='low') w, h = freqz(b, a) plt.plot(w / 3.1415, 20 * np.log10(abs(h))) plt.xlabel('Normalized Frequency') plt.ylabel('Magnitude (dB)') plt.title('Frequency Response') plt.grid(True) plt.show()
Attempts:
2 left
💡 Hint
Check if all required libraries are imported before plotting.
✗ Incorrect
The code uses np.log10 and np without importing numpy as np, causing NameError.
🚀 Application
expert3:00remaining
Choosing filter type for sharp cutoff with minimal ripple
You need to design a digital IIR filter with a very sharp cutoff and minimal passband ripple for a biomedical signal sampled at 1000 Hz. Which filter design and parameters below best meet this requirement?
Attempts:
2 left
💡 Hint
Chebyshev Type II filters have flat passband and sharp cutoff with stopband ripple.
✗ Incorrect
Chebyshev Type II filters have no ripple in passband and sharp cutoff, suitable for minimal passband ripple and sharp transition.