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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

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

Matti Viljamaa
I’m trying to design an arbitrary frequency response filter as described here:

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:


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.plot(fs*w/(2*np.pi), 20*np.log10(abs(h)))
plt.xlim(0, fs/2)
plt.xlabel('Frequency (Hz)')
plt.ylabel('Gain (dB)')

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?

SciPy-User mailing list
[hidden email]