bugGNU Octave - Bugs: bug #39267, signal package: findpeaks:...

 
 

bug #39267: signal package: findpeaks: Error:subscript indices must be either positive integers or logicals

Submitter:  Debatri Chatterjee <debatri>
Submitted:  Mon 17 Jun 2013 10:50:30 AM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Debatri Chatterjee Open/Closed:  * Closed
Release:  * 3.6.4 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 27 Oct 2013 02:34:28 PM UTC, comment #8: 

Ok, closing since the original reported error is at least addressed.

Here is the fix for reference, will be part of the next signal package release.

http://sourceforge.net/p/octave/signal/ci/eacfdb

Mike Miller <mtmiller>
Group Member
Sat 26 Oct 2013 03:33:50 PM UTC, comment #7: 

Carnë,

I would say so. Find peaks works for the data provided, given the right parameters. It is not a jack-of-all-trades, one must use the right parameters for the given data.

Juan Pablo Carbajal <juanpi>
Group Member
Sat 26 Oct 2013 07:12:10 AM UTC, comment #6: 

So should this bug be considered fixed and closed?

Carnë Draug <carandraug>
Group Member
Fri 21 Jun 2013 09:44:11 AM UTC, comment #5: 

Mike,

the implementaton of find peak suses a very rough estimate for the 1st and 2nd derivative. It wont work correctly on data that is not smooth unless you fine tune the parameters, check the demos.
findpeaks is a heuristical function, parameters are important and you have to tune them to get good results.


One possible solution is to implement other methods to find the peaks that are not based on 1st and 2nd derivative. But at the moment I can't work on it.

Juan Pablo Carbajal <juanpi>
Group Member
Fri 21 Jun 2013 02:45:30 AM UTC, comment #4: 

Looks like you have gotten rid of the error message, but certain peaks are missing from the results. Shouldn't it be possible to detect them all? Yes, if you increase the sample rate they are found, but that shouldn't be necessary.

For example if the original example is used but cos() is substituted for sin(), all peaks are found, with both the previous and current revisions of findpeaks.

Mike Miller <mtmiller>
Group Member
Thu 20 Jun 2013 02:12:07 PM UTC, comment #3: 

Hi,

Thanks, I have fixed it in the repository.

Anyways with the signal provided the sampling is too low to get all peaks. Trying with the following works ok (remember that findpeaks uses a rough estimates of first and second derivative, you will need to tune parameters to get good results).

    t = linspace(0,400,1e3)';
    y1 = sin(2*pi*f1/fs*t);
    y2 = sin(2*pi*f2/fs*t);
    data1 = 2 + (0.2*y1 + y2);
    [pks idx] = findpeaks(data1);
    plot (data1,'-',idx,pks,'o')

Juan Pablo Carbajal <juanpi>
Group Member
Thu 20 Jun 2013 12:57:23 PM UTC, comment #2: 

Confirmed with the sample signal provided by OP.

Mike Miller <mtmiller>
Group Member
Mon 17 Jun 2013 12:33:26 PM UTC, comment #1: 

findpeaks() is part of the signal package

Ben Abbott <bpabbott>
Group Member
Mon 17 Jun 2013 10:50:30 AM UTC, original submission:  

I tried to use "findpeaks" in the following block of

> code and is getting Error: subscript indices must be either positive
> integers or logicals.
> t=[1:400]';
> f1=500;
> f2=4000;
> fs=24000;
> ts=1/fs;
> y1=sin(2*pi*f1/fs*t);
> y2=sin(2*pi*f2/fs*t);
> data1=2+(0.2*y1+y2);
> [pks idx] = findpeaks(data1);

Debatri Chatterjee <debatri>

 

(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

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by juanpi (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by carandraug (author of the findpeaks function)
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by debatri (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-06 mtmiller Dependencies- bugs #44446 is dependent
    2013-10-27 mtmiller StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2013-06-20 mtmiller StatusNone Confirmed
        SummaryUnable to use findpeaks : Error:subscript indices must be either positive integers or logicals signal package: findpeaks: Error:subscript indices must be either positive integers or logicals
    2013-06-17 carandraug Carbon-Copy- Added -email is unavailable-
    2013-06-17 bpabbott Operating SystemMicrosoft Windows Any
    2013-06-17 bpabbott CategoryOctave Function Octave Package

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code