[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unable to use findpeaks : Error:subscript indices must be either pos
From: |
Ben Abbott |
Subject: |
Re: Unable to use findpeaks : Error:subscript indices must be either positive integers or logicals |
Date: |
Mon, 17 Jun 2013 18:09:01 +0800 |
On Jun 17, 2013, at 4:52 PM, debatri wrote:
> Hi,
> I am a new octave user. 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);
>
> Please help....
Looks like a bug. Please file a bug-report.
https://savannah.gnu.org/bugs/?group=octave
As a work around, try
idx = find (circshift (data1, 1) < data1 & data1 > circshift (data1,
-1));
pks = data(idx);
Does that what you need?
Ben