I am trying to discretize an analog filter using the ELLIP function with the ‘s’ parameter and the ELLIPAP function. The specifications of the analog filter are the same in both the cases. In the case of using the ELLIP function with the ‘s’ argument, I discretize the filter using bilinear transform as shown in the code below.
Fs = 2e9; FN = Fs/2;fp = 0.4*FN; fs = 0.42*FN;wp = fp*2*pi; ws = fs*2*pi;Ap = 1.2; As = 100;% Calculate filter coefficients and frequency responses
[N, wc] = ellipord(wp, ws, Ap, As, 's'); [B, A] = ellip(N, Ap, As, wc, 's');[bBZT, aBZT] = bilinear(B, A, Fs); [Ha, wa] = freqs(B, A);figure;plot(wa/(2*pi), 20*log10(abs(Ha))) [HB, fB]=freqz(bBZT, aBZT, 512, Fs);hold onplot(fB, 20*log10(abs(HB)), 'r'); legend('Analog Response', 'Digital reponse');
While using the ELLIPAP function, I design the analog prototype first, do the frequency transformation to the specific range and then discretize it, also using bilinear transformation as shown in the code below.
Fs = 2e9; FN = Fs/2;fp = 0.4*FN; fs = 0.42*FN;wp = fp*2*pi;ws = fs*2*pi;Ap = 1.2; As = 100;% Calculate filter coefficients and frequency responses[N, wc] = ellipord(wp, ws, Ap, As,'s'); [z, p, k] = ellipap(N, Ap, As); [A, B, C, D] = zp2ss(z, p, k); [At, Bt, Ct, Dt] = lp2lp(A, B, C, D, wc); [Bs, As] = ss2tf(At, Bt, Ct, Dt);[Ad, Bd, Cd, Dd] = bilinear(At, Bt, Ct, Dt, Fs);[bd, ad] = ss2tf(Ad, Bd, Cd, Dd);[Ha, wa]=freqs(Bs, As);figure; plot(wa/(2*pi), 20*log10(abs(Ha))) hold on[HB, fB]=freqz(bd, ad, 512, Fs);plot(fB, 20*log10(abs(HB)), 'r'); legend('Analog Response(using Analog prototype)', 'Digital response (using Analog prototype)');
However, I observe different responses for the discretized filters generated from the above code.
Best Answer