octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #49996] signal package: cheby2 produces zeros


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #49996] signal package: cheby2 produces zeros that are not quite complex conjugate pairs
Date: Sat, 7 Jan 2017 03:13:16 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0

Follow-up Comment #4, bug #49996 (project octave):

the help thread first links back to an older post with the zp2sos cplxpair
error, but in that case z,p,k come from butter, not cheby2.  

here's the script that fails with butter:

>> bandHz = [100 500];
>> sampleFreq = 1001;
>> nyquistFreq = 0.5 * sampleFreq;
>> w = bandHz / nyquistFreq;
>> [z,p,k] = butter(2, w);z',p',k
ans =
   1
   1
  -1
  -1
ans =
   0.571788211592795 + 0.293698922713578i
   0.571788211592761 - 0.293698922713564i
  -0.997780778679612 - 0.002216561341880i
  -0.997780778679612 + 0.002216561341880i
k =  0.637776870938282
>> [sos,g] = zp2sos(z,p,k);
error: cplxpair: could not pair all complex numbers
error: called from
    cplxpair at line 118 column 9
    cplxreal at line 52 column 9
    zp2sos at line 78 column 10


in Matlab 2016b, the output produced is:


[z,p,k] = butter(2, w)
z =
     1
     1
    -1
    -1
p =
  0.571788211592765 + 0.293698922713572i
  0.571788211592765 - 0.293698922713572i
 -0.997780778679611 + 0.002216561341880i
 -0.997780778679611 - 0.002216561341880i
k =
   0.637776870938272
>> [sos,g] = zp2sos(z,p,k)
sos =
  Columns 1 through 4
   1.000000000000000  -2.000000000000000   1.000000000000000  
1.000000000000000
   1.000000000000000   2.000000000000000   1.000000000000000  
1.000000000000000
  Columns 5 through 6
  -1.143576423185530   0.413200816119565
   1.995561557359223   0.995571395446674
g =
   0.637776870938272


the patch on the thread adjusted the way zeros are calculated within cheby2,
and the code ran without error except for an ordering issue. Maybe the bug
needs to be broadened to butter, and maybe cheby1 and ellip as well?  is there
a similarly easy test for those?

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49996>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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