2011/11/21 Jerry <lancebo...@qwest.net>: > On Nov 19, 2011, at 5:46 PM, Carnë Draug wrote: >> On 19 November 2011 23:58, Jerry <lancebo...@qwest.net> wrote: >>> Hi All, >>> >>> The function zp2sos in Signals always returns 1.0 for the gain of the >>> second order sections. This isn't very useful. I believe it should return >>> the gain factor to make the cascade of second order sections equal to the >>> input filter which is in the form [zeros poles gain]. Indeed, this is the >>> behavior described for the Matlab version at >>> http://www.mathworks.com/help/toolbox/signal/ref/zp2sos.html. >>> >>> An example that shows the problem is simply to convert a second order >>> filter in z-p-g form to a single second order section: >>> >>> octave-3.4.0:1> [b,a] = butter(2, 0.2) >>> b = >>> >>> 0.067455 0.134911 0.067455 >>> >>> a = >>> >>> 1.00000 -1.14298 0.41280 >>> >>> octave-3.4.0:2> [z, p, g] = butter(2, 0.2) >>> z = >>> >>> -1 -1 >>> >>> p = >>> >>> 0.57149 + 0.29360i 0.57149 - 0.29360i >>> >>> g = 0.067455 >>> octave-3.4.0:3> [sos, sos_g] = zp2sos(z', p') >>> sos = >>> e >>> 1.00000 2.00000 1.00000 1.00000 -1.14298 0.41280 >>> >>> sos_g = 1 >>>>> Should be 0.067455 <<<<<< >>> >>> >>> The filter from the first input line should be the same as from the last >>> input line but it differs in the gain factor. This is easy to fix but as it >>> is the user has to do it. >>> >>> On two related matters, the Octave documentation for zp2sos, >>> http://octave.sourceforge.net/signal/function/zp2sos.html, states that the >>> arguments to zp2sos should be column vectors but using either column or row >>> vectors results in the same answer. >>> >>> Also, on the same doc page, a quantity called Bscale is mentioned, but only >>> once; it does not reference anything on the page. This should also be >>> fixed. It probably refers to g but g is incorrect as noted above. >>> >>> I suppose the functions mentioned in the "See also" should be checked for >>> similar problems. >>> >>> Jerry >> >> >> Hi Jerry, >> >> do you think you can submit a patch to fix these (or maybe just some) >> of the issues? >> >> Carnë > > I could fix the problem if the source is Octave, but not if it is C. > Jerry
The function is a m file so written in octave. You can see the source of the file here http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/main/signal/inst/zp2sos.m?revision=9164&view=markup or you can svn checkout the whole signal package with: svn co https://octave.svn.sourceforge.net/svnroot/octave/trunk/octave-forge/main/signal I have also added this bug to the bug tracker here https://sourceforge.net/tracker/?func=detail&aid=3440905&group_id=2888&atid=102888 Carnë ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Octave-dev mailing list Octave-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/octave-dev