octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #42859] bugs in periodogram.m


From: Drew Abbot
Subject: [Octave-bug-tracker] [bug #42859] bugs in periodogram.m
Date: Mon, 28 Jul 2014 05:25:09 +0000
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?42859>

                 Summary: bugs in periodogram.m
                 Project: GNU Octave
            Submitted by: drewabbot
            Submitted on: Mon 28 Jul 2014 05:25:07 AM GMT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Drew Abbot
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

There are two bugs in the current periodogram() implementation, and here's a
new version which fixes both.  The first bug is that, when using one-sided
spectra (the default behavior), only column vectors are supported for the
input signal, x.  Sending in row vectors causes a "vertical dimensions
mismatch" error due to this one-sided conversion code:

 
  Pxx = Pxx(1:nfft/2+1) + [0; Pxx(end:-1:(nfft/2+2)); 0];


To witness the bug, simply attempt:


  pxx = periodogram( sin(1:10) )


The second also involves that one-sided conversion code.  Namely, it is
incorrect when nfft is odd, since it yields 1/2 the correct value at the
upper-most (non-Nyquist) frequency.

To see this, note that the following returns ~0.0171 for the third component,
when it should return ~0.0342:

 
  pxx = periodogram( sin(1:5)', [], 5 )


The proposed fixes address both issues (using similar one-sided conversion
code to that found in the current pwelch() implementation of the signal
package), and also forces that the window (if non-empty) is a vector of the
same length as the signal (which is the current MATLAB behavior).






    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 28 Jul 2014 05:25:07 AM GMT  Name: periodogram.diff  Size: 1kB   By:
drewabbot

<http://savannah.gnu.org/bugs/download.php?file_id=31783>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?42859>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]