bugGNU Octave - Bugs: bug #65614, Negative window values on Signal...

 
 

bug #65614: Negative window values on Signal pwelch

Submitter:  None
Submitted:  Fri 19 Apr 2024 04:46:42 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  lostbard
Originator Name:  Mariano Boragno Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * stable
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 22 Sep 2024 08:32:24 PM UTC, comment #5: 

v1.4.6 was released

John Donoghue <lostbard>
Group Member
Sat 07 Sep 2024 01:35:59 PM UTC, comment #4: 

ive been working on a release that contains this and some other fixes, which hopefully will be completed soon.

John Donoghue <lostbard>
Group Member
Sat 07 Sep 2024 11:30:17 AM UTC, comment #3: 

It has been merged. The only thing not done yet is a new release of the package containing this (and other fixes)

John Donoghue <lostbard>
Group Member
Sat 07 Sep 2024 04:21:48 AM UTC, comment #2: 

comment #1:

> Pushed to repo https://sourceforge.net/p/octave/signal/ci/e5e55abbc84a2bfeb5d27f88e14f845e8e23851b/


Hi, this has been in testing for months. I tested it and works perfectly fine for me, in case it helps.

Only one comment: line 558 should be changed from:

error( 'pwelch: arg %d (window) vector must be real and >=0',iarg+1);

to:

error( 'pwelch: arg %d (window) vector must be real',iarg+1);

Not sure how I can help to get this closed and merged. Please let me know.

Thanks,

Mariano Boragno <marianoboragno>
Sat 20 Apr 2024 11:54:46 AM UTC, comment #1: 
John Donoghue <lostbard>
Group Member
Fri 19 Apr 2024 04:46:42 PM UTC, original submission:  

The simple code below returns “error: pwelch: arg 2 (window) vector must be real and >=0”.


% create a simple signal
k = 1:128;
x = sin(2 * pi * k / 10);
% create the window function
win = flattopwin(128);
% calculate the spectrum with a flattop window
pwelch(x, win)


I can see in the pwelch.m file line 558 (https://sourceforge.net/p/octave/signal/ci/default/tree/inst/pwelch.m#l558) this condition is checked and enforced.
This is also consistent with pwelch's help:

 window
      [real vector] of window-function values between 0 and 1; the
      data segment has the same length as the window.  Default
      window shape is Hamming.

I agree the window must be a real vector, but why does it require to be >= 0? As far as I understand there is no mathematical reason for that requirement and, in fact, falttop windows have negative values.

This is an easy fix on line 557 and, of course, the documentation:


- elseif ( is_win>1 && ( ~isreal(arg) || any(arg<0) ) )
+ elseif ( is_win>1 && ( ~isreal(arg) ) )


Thanks,

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by marianoboragno (Posted a comment)
  • -email is unavailable- added by lostbard (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-09-22 lostbard StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2024-04-20 lostbard StatusNone Ready For Test
        Assigned toNone lostbard

    Back to the top

    Powered by Savane 3.14-3b9d.
    Corresponding source code