I have to design 2 IIR bandpass filter with the following specifications:
Sampling frequency 1000 Hz Pass-band 50 Hz to 200 Hz Order 6 using bilinear transform and impulse invariance with Butterworth prototype analogue filter.
I'm confused, because the two methods I've got for producing the filters have different results.
fs = 1000; fNq = fs/2; f1 = 50/fNq; f2 = 200/fNq; [z,p,k] = buttap(6); [A,B,C,D] = zp2ss(z,p,k); [zd,pd,kd] = bilinear(z,p,k,fs); Bw = f2-f1; Wo = sqrt(f1*f2); [At,Bt,Ct,Dt] = lp2bp(A,B,C,D,Wo,Bw); [b,a] = ss2tf(At,Bt,Ct,Dt); [Ad,Bd,Cd,Dd] = bilinear(At,Bt,Ct,Dt,fs); [bz, az] = ss2tf(Ad,Bd,Cd,Dd); fvtool(bz,az);
(I think that) The above code creates an analogue prototype, transforms to a state-space form, applies the bilinear transform, transforms the low-pass filter to a band-pass filter, transforms to a transfer function and the plots it.
My problem is that it is noticably different to:
[num,den] = butter(6, [f1, f2], 's'); [B,A] = bilinear(num, den, fs); fvtool(B, A);
I have similar problems with the impulse invariance method.
Could someone please give me a hint as to what I'm doing wrong?