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

 
 

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

Submitted by:  Debatri Chatterjee <debatri>
Submitted on:  Mon 17 Jun 2013 10:50:30 AM UTC  
 
Category: Octave Forge PackageSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Debatri ChatterjeeOpen/Closed: Closed
Release: 3.6.4Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

(Jump to the original submission 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>
Project Administrator
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>
Project Member
Sat 26 Oct 2013 07:12:10 AM UTC, comment #6:

So should this bug be considered fixed and closed?

Carnë Draug <carandraug>
Project 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>
Project 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>
Project Administrator
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(2pif1/fs*t);
y2 = sin(2pif2/fs*t);
data1 = 2 + (0.2*y1 + y2);
[pks idx] = findpeaks(data1);
plot (data1,'-',idx,pks,'o')

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

Confirmed with the sample signal provided by OP.

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

findpeaks() is part of the signal package

Ben Abbott <bpabbott>
Project 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(2pif1/fs*t);
> y2=sin(2pif2/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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

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

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 06 Mar 2015 02:40:31 PM UTCmtmillerDependencies-=>bugs #44446 is dependent
    Sun 27 Oct 2013 02:34:28 PM UTCmtmillerStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Thu 20 Jun 2013 12:57:23 PM UTCmtmillerStatusNone=>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
    Mon 17 Jun 2013 04:27:40 PM UTCcarandraugCarbon-Copy-=>Added -unavailable-
    Mon 17 Jun 2013 12:33:26 PM UTCbpabbottOperating SystemMicrosoft Windows=>Any
    Mon 17 Jun 2013 12:33:25 PM UTCbpabbottCategoryOctave Function=>Octave Forge Package

    Back to the top


    Powered by Savane 3.1-cleanup1