help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: zp2sos error: cplxpair: could not pair all complex numbers


From: Ozzy Lash
Subject: Re: zp2sos error: cplxpair: could not pair all complex numbers
Date: Thu, 5 Jan 2017 13:30:41 -0600

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.

Bill

On Thu, Jan 5, 2017 at 12:38 PM, Mike Miller <address@hidden> wrote:
On Thu, Jan 05, 2017 at 09:45:29 -0800, Mike Miller wrote:
> Thanks for running that. So yeah, looks like the bilinear function could
> use some improvement here. If this last conjugate pair were correct,
> there would be no error in cplxpair.

To clarify, to the OP in particular, this does not necessarily mean that
any work is now automatically going to be done to fix this.

If you care about this bug in particular, which it seems like you do,
you should expect to do some work to help get it fixed. If you don't at
the very least file a bug report, and preferably do some investigation
to help fix this, nothing will be fixed.

This thread will be forgotten by the end of this week or next. Someone
may very well come along in 2022 and ask why this is still not working
correctly if you don't do something now to help fix it.

--
mike

_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave


reply via email to

[Prev in Thread] Current Thread [Next in Thread]