grpdelay misses nfft

Søren Hauberg soren at hauberg.org
Fri Nov 14 06:34:36 CST 2008


fre, 14 11 2008 kl. 13:28 +0100, skrev Sven Köhler:
> Søren Hauberg schrieb:
> > fre, 14 11 2008 kl. 11:28 +0100, skrev Sven Köhler:
> >> Something's missing (well: nfft), but why and how can i fix it?
> > 
> > I'm guessing that the function should be calling 'fftn' and not 'nfft'.
> > Could you try and make that change, and see if the function returns what
> > you want?
> 
> The corresponding code is:
> 
> 
> function [gd,w] = grpdelay(b,a,nfft,whole,Fs)
> 
>    if (nargin<1 || nargin>5)
>      usage("[g, w]=grpdelay(b [, a [, n [, 'whole' [, Fs]]]])");
>    end
>    HzFlag=0;
>    if length(nfft)>1
>      if nargin>4
>        print_usage();
> 
> 
> line 94, that's the line "if length(nfft)>1".
> 
> So apperantly, somebody tries to use length with the undefined value. 
> And that crashes.
> 
> So that needs to be fixed in octave-forge.
> A simple woraround:
> 
> instead of grpdelay(b,a) use grpdelay(b,a,512)

Okay, I guess I should have looked at the code before answering. I've
changed

  function [gd,w] = grpdelay(b,a,nfft,whole,Fs) 

to

  function [gd,w] = grpdelay(b,a=1,nfft=512,whole,Fs) 

in SVN, which should fix the bug. The code could, however, still use
some cleaning up, so if anybody feels like doing that, please go
ahead...

Søren



More information about the Bug-octave mailing list