help-octave
[Top][All Lists]
Advanced

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

Re: Signal: zp2sos and cplxpair problem


From: Doug Stewart
Subject: Re: Signal: zp2sos and cplxpair problem
Date: Mon, 30 Apr 2012 16:16:12 -0400



On Mon, Apr 30, 2012 at 9:49 AM, Sergei Steshenko <address@hidden> wrote:

--- On Mon, 4/30/12, Doug Stewart <address@hidden> wrote:

From: Doug Stewart <address@hidden>
Subject: Re: Signal: zp2sos and cplxpair problem
To: "steven_ew" <address@hidden>
Cc: address@hidden
Date: Monday, April 30, 2012, 6:32 AM



On Mon, Apr 30, 2012 at 7:24 AM, steven_ew <address@hidden> wrote:

Hi



I am new to Octave but quite experience in Matlab. I am trying to get a

script to run that creates and applies a Butterworth filter (it is a script

I have used lots in Matlab).



The key lines are :



bandHz = [100 500];

sampleFreq = 1001;

nyquistFreq = 0.5 * sampleFreq;

w = bandHz / nyquistFreq;

[z,p,k] = butter(2, w);

[sos,g] = zp2sos(z,p,k);



However, when Octave gets to zp2sos it gives this error:



error: cplxpair: could not pair all complex numbers

error: called from:

error:   /usr/local/share/octave/3.6.1/m/general/cplxpair.m at line 126,

column 9

error:   /home/steven/octave/signal-1.1.2/cplxreal.m at line 53, column 7

error:   /home/steven/octave/signal-1.1.2/zp2sos.m at line 70, column 10





I wondered if someone could help me go about fixing this problem or give

some hint about where to start?





Thank you in advance for your help





Steven


Confirmed, I get the same error message. 
The problem is that you are asking for a band pass filter and trying to do it with a second order filter.
Try a 4th order filter.
[z,p,k] = butter(4, w);
Doug
--
DAS
https://linuxcounter.net/user/206392.html



-----Inline Attachment Follows-----

_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave

First of all, the error message is not clear.

Secondly, cascaded 1-st order HPF and LPF can form a BPF, though a low Q one. And the resulting BPF will be 2-nd order one.

Regards,
 Sergei.


I took another look at this problem.
It is the same in Octave 3.2.3 so it is not new.

The filter that is being designed is not practical in my opinion. 
The sample freq=1001 therefor nyquist is  500.5 and the upper corner freq. is at 500 with a 2 pole roll off!!
If we set the upper corner freq. to 499.99 then the program runs OK.
If we go to a higher order filter the problem also goes away.
If we go to a sample freq of 1002 the problem goes away.

So in conclusion 
1) the program does not crash
2) the particular filter is not practical. (Why have a corner freq. at .99 of nyquist?)
3) the complex numbers seem to be very close to each other and the software reports that-
  " could not pair all complex numbers" 

I don't intend to spend any more time on this. ( I think it is a corner case that is not too important)
Others may try to fix it.

Doug



--
DAS

https://linuxcounter.net/user/206392.html

reply via email to

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