John Williams answered .
2025-07-03 09:55:14
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