Matti Viljamaa
2016-08-29 13:56:38 UTC
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?
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?