octave-maintainers
[Top][All Lists]
Advanced

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

Re: bugs in periodogram.m (and proposed fixes)


From: Drew Abbot
Subject: Re: bugs in periodogram.m (and proposed fixes)
Date: Tue, 22 Jul 2014 00:01:10 -0700

Thanks Juan.  I was just about to file a bug report and a diff, but then, upon updating my Mercurial repo, I see the fix is already in there.  And whoops, sorry for the accidental double-post to the mailing list.  :)




On Mon, Jul 21, 2014 at 11:30 PM, Juan Pablo Carbajal <address@hidden> wrote:
On Tue, Jul 22, 2014 at 4:40 AM, Drew Abbot <address@hidden> wrote:
> 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 attached code fixes both issues (using similar one-sided conversion code
> to that found in the current pwelch() implementation), 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).
>
> Best,
> Drew Abbot

Dear Drew,

Thanks a lot for your help.
Now the correct place to send patches is not the mailing list but the
patch tracker (in the mailing list your work can be lost!)
https://savannah.gnu.org/patch/?group=octave

You might want to submit a diff file instead of a full file, maybe?
Your choice, a diff file is easier to revise, so your work can be
moved into octave faster.

Cheers


reply via email to

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