[SciPy-User] freqz -style plot of "window design" FIR?

Matti Viljamaa mviljamaa at kapsi.fi
Mon Aug 29 09:56:38 EDT 2016


I’m trying to design an arbitrary frequency response filter as described here:
http://www.dspguide.com/ch17/1.htm <http://www.dspguide.com/ch17/1.htm>

The technique is said to result in an impulse response in time domain and later in to a filter kernel.

I’ve been using scipy.signal.freqz to make magnitude response plots:

e.g.

fs = 44100

# Design a low-pass filter using remez.
cutoff = 2000.0
transition_width = 200
bands = np.array([0, cutoff - 0.5*transition_width,
                  cutoff + 0.5*transition_width, fs/2.0]) / fs
desired = [1, 0]
lpf = remez(513, bands, desired)

# Plot the frequency response of the filter.
w, h = freqz(lpf)
plt.figure(1)
plt.plot(fs*w/(2*np.pi), 20*np.log10(abs(h)))
plt.xlim(0, fs/2)
plt.xlabel('Frequency (Hz)')
plt.ylabel('Gain (dB)')
plt.grid(True)

But my question is, if using the above arbitrary frequency response design technique, would I be able to use freqz?

freqz takes as a parameter “numerator of a linear filter” and remez is returning an array of coefficients, which I read to be the same thing.

But in the case of the arbitrary frequency response filter, what can I put into freqz? Is filter kernel perhaps the same as coefficients?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20160829/119a2428/attachment.html>


More information about the SciPy-User mailing list