Elliptic (Cauer) digital and analog filter design.
Design an Nth order digital or analog elliptic filter and return the filter coefficients in (B,A) or (Z,P,K) form.
Parameters: | N : int
rp : float
rs : float
Wn : array_like
btype : {‘lowpass’, ‘highpass’, ‘bandpass’, ‘bandstop’}, optional
analog : bool, optional
output : {‘ba’, ‘zpk’}, optional
|
---|---|
Returns: | b, a : ndarray, ndarray
z, p, k : ndarray, ndarray, float
|
See also
Notes
Also known as Cauer or Zolotarev filters, the elliptical filter maximizes the rate of transition between the frequency response’s passband and stopband, at the expense of ripple in both, and increased ringing in the step response.
As rp approaches 0, the elliptical filter becomes a Chebyshev type II filter (cheby2). As rs approaches 0, it becomes a Chebyshev type I filter (cheby1). As both approach 0, it becomes a Butterworth filter (butter).
The equiripple passband has N maxima or minima (for example, a 5th-order filter has 3 maxima and 2 minima). Consequently, the DC gain is unity for odd-order filters, or -rp dB for even-order filters.
Examples
Plot the filter’s frequency response, showing the critical points:
>>> from scipy import signal
>>> import matplotlib.pyplot as plt
>>> b, a = signal.ellip(4, 5, 40, 100, 'low', analog=True)
>>> w, h = signal.freqs(b, a)
>>> plt.plot(w, 20 * np.log10(abs(h)))
>>> plt.xscale('log')
>>> plt.title('Elliptic filter frequency response (rp=5, rs=40)')
>>> plt.xlabel('Frequency [radians / second]')
>>> plt.ylabel('Amplitude [dB]')
>>> plt.margins(0, 0.1)
>>> plt.grid(which='both', axis='both')
>>> plt.axvline(100, color='green') # cutoff frequency
>>> plt.axhline(-40, color='green') # rs
>>> plt.axhline(-5, color='green') # rp
>>> plt.show()