help-octave
[Top][All Lists]
Advanced

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

findpeak


From: asha g
Subject: findpeak
Date: Wed, 28 Mar 2012 23:35:32 +0800 (SGT)

Sending again
 
 


Regardless, here's a solution that *won't work for every dataset*, but I
think will work in your case.

% first derivative (kind of)
dx = diff(vvl);
% second derivative (kind of)
dxx = diff([0,dx]);
% peaks (peaks = -2, troughs = 2)
idx = find(dxx == -2);

% now get the peak vvl values & corresponding x values
vvl(idx)
x(idx)

I tested this with a very simple dataset and it worked, but can't guarantee
it will always work.  In particular, if the peak is something like this:
[1,2,3,3,3,2,1], this code will not identify it.  Looking at the plot you
sent me, it should be ok.

Andrew

Sorry, I can't get this to work but is there something in octave similar to Matlab's
pks = findpeaks(data)
[pks,locs] = findpeaks(data) returns the indices of the local peaks.

If I can get this, then my problem is solved.
Thanks
Asha



_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave



reply via email to

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