Why do I receive two different responses when I try to discretize the same analog filter using the ELLIP

Illustration
Jacqueline - 2021-03-10T11:10:28+00:00
Question: Why do I receive two different responses when I try to discretize the same analog filter using the ELLIP

Why do I receive two different responses when I try to discretize the same analog filter using the ELLIP and ELLIPAP functions in  Signal Processing Toolbox 6.12 (R2009b)?   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 on plot(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.  

Expert Answer

Profile picture of John Williams John Williams answered . 2025-11-20

The two approaches used to discretize the analog filter are theoretically equivalent. However, they present different numerical challenges.
 
In the script that uses ELLIP, a transfer function is generated, which should almost always be avoided if one wishes to obtain a numerically robust filter. The modified script below will yield the same filter whether you use ELLIP or ELLIPAP:
Fs=2e9; 

FN=Fs/2; % Sampling and Nyquist frequencies

fp=0.4*FN; 

fs=0.42*FN; %Passband and Stopband frequencies

wp=fp*2*pi; 

ws=fs*2*pi; %Passband and Stopband edge frequencies

Ap=1.2; 

As=100; % Passband and Stopband attenuation

% Calculate filter coefficients and frequency responses

[N, wc]=ellipord(wp, ws, Ap, As, 's'); % analog filter

%--------------------------------------------------------------------------

% Design using ELLIP for the analog prototype

%--------------------------------------------------------------------------

[A, B, C, D] = ellip(N, Ap, As, wc, 's');

[Ad, Bd, Cd, Dd] = bilinear(A, B, C, D, Fs);

[sos, g] = ss2sos(Ad, Bd, Cd, Dd);

hd1 = dfilt.df2sos(sos, g);

%--------------------------------------------------------------------------

% Design using ELLIPAP for the analog prototype

%--------------------------------------------------------------------------

[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);

[sos, g] = ss2sos(Ad, Bd, Cd, Dd);

hd2 = dfilt.df2sos(sos, g);

fvtool(hd1, hd2)


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!