bugGNU Octave - Bugs: bug #39729, Signal library periodogram returns...

 
 

bug #39729: Signal library periodogram returns incorrect result for row vectors

Submitter:  None
Submitted:  Thu 08 Aug 2013 03:24:48 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  m.reich Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 07 Aug 2014 06:01:01 PM UTC, comment #3: 

I pushed a changeset that should fix this (http://hg.savannah.gnu.org/hgweb/octave/rev/8ac4ab4ae5f4).  Marking the bug as Ready For Test.

Rik <rik5>
Group administrator
Fri 09 Aug 2013 03:34:35 AM UTC, comment #2: 

Thanks for confirming.

Yes, it probably should work if lengths are the same, subject to compatibility. 

As written, the function seems to broadcast a column window across the columns of a matrix signal argument, which is compatible with fft matrix handling.  But, I have not tested this.

M.Reich

Anonymous
Fri 09 Aug 2013 02:50:15 AM UTC, comment #1: 

Confirmed in the development version of Octave as well. The window is not applied but the signal is still normalized by the window power.

The function also fails if the signal argument is a row vector instead of a column vector, with or without a window. I think it should work on any combination of row or column vector inputs as long as they have the same length.

Mike Miller <mtmiller>
Group Member
Thu 08 Aug 2013 03:24:48 PM UTC, original submission:  

periodogram(x,win,...)returns an incorrect result if win is a row vector or if win is a column vector whose length does not equal the length of parameter x.  Here, '...'  represents be the remaining optional parameters.

In the current implementation of periodogram, lines 108 through 114 apply the window 'win' only if either
   (size (x) == size (window)
or if
   (size (x, 1) == size (window, 1) && size (window, 2) == 1)
As a result,  if 'win' is a row vector whose length equals the length of 'x', the window is not applied, although it would make sense to do so.  In the case that the lengths of 'win' and 'x' do not match, it would make sense to flag an error.

Moreover, since line 147 normalizes the periodogram by 'win'even if the window was not applied, the function can return an incorrect result. 

Most window functions in the signal library work correctly as the 'win' parameter since they return column vectors, e.g.
    size(blackman(1000))
But those which return row vectors need conversion to column a vector to work correctly, e.g
    size(blackmanharris(1000))


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #31784:  periodogram.diff added by drewabbot (1KiB - application/octet-stream - whoops, new bug #42859 just reported for this issue (and more) -- here's my proposed fix)

 

Depends on the following items: None found

Items that depend on this one

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by drewabbot (Updated the item)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-08-15 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2014-08-07 rik5 StatusConfirmed Ready For Test
    2014-07-29 andy1978 Dependencies- bugs #42859 is dependent
    2014-07-28 drewabbot Attached File- Added periodogram.diff, #31784
    2013-08-09 mtmiller CategoryLibraries Octave Function
        StatusNone Confirmed
        Release3.6.4 dev
        Operating SystemOther Any
        SummarySignal library periodogram returns incorrect result for row vector windows Signal library periodogram returns incorrect result for row vectors

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code