I'm not sure that it is a problem in bilinear, it may be in sftrans. If you do the pre-warping that is done in the cheby2 function for the digital case, and then run cheby2 with the "s" flag, the zeroes that result also don't pass the cplxpair test, unless you raise the tolerance to about 400*eps
>> pkg load signal
>> format long
>> stages=6;
>> reject=40;
>> fsamp = 1000;
>> fpL=0.52915085925565918945068233369966;
>> fpH=491.55617297547132693580351769924;
>> Ww=2/2*tan(pi*[fpL.*2./fsamp,fpH.*2./fsamp]/2)
Ww =
1.66237798340326e-03 3.76885052761635e+01
>> [zw,pw,kw]=cheby2(stages,reject,Ww,"s");
>> [~,idx] = sort(abs(zw));
>> zw(idx).'
ans =
0.000000000000000 - 0.000430272789501i
0.000000000000000 + 0.000430272789515i
0.000000000000000 + 0.001175504669177i
0.000000000000000 - 0.001175504669177i
0.000000000000000 + 0.001605738571502i
0.000000000000000 - 0.001605738571502i
0.000000000000000 + 39.017896505914251i
-0.000000000000000 - 39.017896505914251i
0.000000000000000 + 53.298419854299617i
-0.000000000000000 - 53.298419854299624i
0.000000000000000 + 145.611209739393132i
-0.000000000000000 - 145.611209739393217i
>> cplxpair(zw)
error: cplxpair: could not pair all complex numbers
error: called from
cplxpair at line 128 column 9
I'd guess that the issue may be in sftrans around this area:
b = (C*(Fh-Fl)/2)./Sz;
Sz = [b+sqrt(b.^2-Fh*Fl), b-sqrt(b.^2-Fh*Fl)];
when you have larrge and small magnitude values of zeroes, you probably lose precision.