0
0
SciPydata~10 mins

FIR filter design (firwin) in SciPy - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the firwin function from scipy.signal.

SciPy
from scipy.signal import [1]
Drag options to blanks, or click blank then click option'
Alfilter
Bfft
Cbutter
Dfirwin
Attempts:
3 left
💡 Hint
Common Mistakes
Importing the wrong function like butter or fft.
Forgetting to import from scipy.signal.
2fill in blank
medium

Complete the code to design a lowpass FIR filter with 51 taps and cutoff frequency 0.3 (normalized).

SciPy
coefficients = firwin([1], cutoff=0.3)
Drag options to blanks, or click blank then click option'
A100
B10
C51
D25
Attempts:
3 left
💡 Hint
Common Mistakes
Using too small or even number of taps.
Confusing cutoff frequency with number of taps.
3fill in blank
hard

Fix the error in the code to design a highpass FIR filter with 31 taps and cutoff 0.4.

SciPy
coeffs = firwin(31, cutoff=0.4, [1]=False)
Drag options to blanks, or click blank then click option'
Apass_zero
Bhighpass
Cstopband
Dbandpass
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'highpass' as a parameter name (not valid).
Omitting the pass_zero parameter.
4fill in blank
hard

Fill both blanks to design a bandpass FIR filter with 61 taps and cutoff frequencies 0.2 and 0.5.

SciPy
coeffs = firwin([1], cutoff=[2], pass_zero="bandpass")
Drag options to blanks, or click blank then click option'
A61
B[0.2, 0.5]
C31
D[0.1, 0.4]
Attempts:
3 left
💡 Hint
Common Mistakes
Using a single cutoff value instead of a list.
Setting pass_zero=True for bandpass.
5fill in blank
hard

Fill all three blanks to create a FIR filter with 41 taps, cutoff 0.25, and use a Hamming window.

SciPy
coeffs = firwin([1], cutoff=[2], window=[3])
Drag options to blanks, or click blank then click option'
A41
B0.25
C'hamming'
D'hann'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong window type like 'hann' instead of 'hamming'.
Confusing cutoff frequency with number of taps.