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


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

Submitted by:  None
Submitted on:  Thu 08 Aug 2013 03:24:48 PM UTC  
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: m.reichOriginator Email: -email is unavailable-
Open/Closed: ClosedRelease: dev
Operating System: Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


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>
Project 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.


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>
Project Administrator
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.
But those which return row vectors need conversion to column a vector to work correctly, e.g



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

Attach File(s):

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

   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)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 10 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 15 Aug 2014 03:53:52 PM UTCrik5StatusReady For Test=>Fixed
    Thu 07 Aug 2014 06:01:01 PM UTCrik5StatusConfirmed=>Ready For Test
    Tue 29 Jul 2014 06:51:28 AM UTCandy1978Dependencies-=>bugs #42859 is dependent
    Mon 28 Jul 2014 05:39:57 AM UTCdrewabbotAttached File-=>Added periodogram.diff, #31784
    Fri 09 Aug 2013 02:50:15 AM UTCmtmillerCategoryLibraries=>Octave Function
      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.1-cleanup1