I have a 1st order low-pass filter (LPF) in the frequency domain and I want to digitize it. I am comparing the frequency response graphs for testing, but I'm getting weird results...
Though very basic, I couldn't get it right from reading the scipy.signal.bilinear
help page or the net.
num
,den
: numerator and denominator in S planeb
,a
: I'm expecting it to beb
,a
coefficients of a digital difference equation filter (IIR), of the shape: Y[n] = a0*X[n] + a1*X[N-1] + ... - b1*Y[n-1] ...
Here is a code example:
Fs = 48000.0
f = 2 * np.logspace(1,4,1024)
num = [0 , 1]
den = [0.001 , 1]
tmp, H = sig.freqs(num, den, worN=1024)
b, a = sig.bilinear(num, den, 1.0)
tmp, Hd = sig.freqz(b,a, worN=1024)
plt.semilogx(f, 20*np.log10(np.abs(H)))
plt.semilogx(f, 20*np.log10(np.abs(Hd)))
What am I doing wrong?