From help-request at octave dot org Sun Apr 16 01:03:52 2006 Subject: Re: freqz / postpad problem From: Quentin Spencer To: "Dmitri A. Sergatskov" CC: Octave Help Date: Sun, 16 Apr 2006 01:02:47 -0500 Dmitri A. Sergatskov wrote: > I found a buglet in freqz (octave 2.9.4, Quentin's rpm for Fedora Core 5). > "test freqz" fails with the following error: > > octave:57> test freqz > ***** test # whole-half consistency > b = [1 1 1]/3; # 3-sample average > [h,w] = freqz(b,1,32,'whole'); > assert(h(2:16),conj(h(32:-1:18)),20*eps); > [h2,w2] = freqz(b,1,16,'half'); > assert(h(1:16),h2,20*eps); > assert(w(1:16),w2,20*eps); > !!!!! test failed > error: quotient: nonconformant arguments (op1 is 1x32, op2 is 32x1) > > The culprit is the follqwing code (lines 134 and 135 in freqz.m): > > > hb = fft (postpad (b, n)); > ha = fft (postpad (a, n)); > > (and later) > > h = hb ./ ha; > > The problem here is that when b is a vector (e.g. 1:m) postpad > and consecuetly fft return 1:n vector as well, but if a is just a number > then postpad (and fft later) return n:1 vector. > > I really do not know what would be the best fix. In particular I am > not sure that postpad behavior is OK. > Try out the CVS version of freqz--it should fix your problems. I think I reported this same bug a while ago on the 2.1.x branch. The freqz function had quite a few changes made to it recently, but apparently after 2.9.4. I suppose the best fix for this would be a 2.9.5 release for Fedora. The reason I hadn't done that yet was that the current octave-forge release has the old behavior for the system function, so it shouldn't really be used for 2.9.5 or later. I could try patching it, but I thought a new release would be easier. Anyway, I'll figure something out soon, but it's getting late for me to do it today. -Quentin ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------