[SciPy-User] plot sos (freqz for sos) filter

Neal Becker ndbecker2 at gmail.com
Mon Jun 6 15:25:31 EDT 2016


Happy to see sos format supported.  Getting the response of the sos design 
requires a little effort.  A nice addition would be for freqz to directly 
support an sos input.

Here's some code which I'm using for now:

sos = signal.ellip (8, 0.5, 80, 0.5 * 500e3/(sps*250e6), output='sos')
ba = [signal.sos2tf(s[np.newaxis,:]) for s in sos]
ws = np.pi * np.logspace (-4, 0, num=500)
wh = [signal.freqz (_[0],_[1],worN=ws) for _ in ba]
plt.semilogx (wh[0][0]/np.pi, np.clip (20*np.log10(np.abs(np.prod ([_[1] for 
_ in wh], axis=0))),-100,0))






More information about the SciPy-User mailing list