FINDEXTREMA Finds indices to minima and maxima of data CALL: ind = findextrema(x); x = vector with sampled values. ind = indices to minima and maxima in the original sequence x. Example t = linspace(0,7*pi,250); x = sin(t); ind = findextrema(x) plot(t,x,'.',t(ind),x(ind),'r.') See also findcross, crossdef
Finds indices to level v up and downcrossings of a vector | |
Difference and approximate derivative. |
Extracts turning points from data, |
01 function ind = findextrema(x) 02 %FINDEXTREMA Finds indices to minima and maxima of data 03 % 04 % CALL: ind = findextrema(x); 05 % 06 % x = vector with sampled values. 07 % 08 % ind = indices to minima and maxima in the original sequence x. 09 % 10 % Example 11 % t = linspace(0,7*pi,250); x = sin(t); 12 % ind = findextrema(x) 13 % plot(t,x,'.',t(ind),x(ind),'r.') 14 % 15 % See also findcross, crossdef 16 17 18 % Tested on: Matlab 5.3, 5.2 5.1 19 20 % History: 21 % by pab April2004 22 23 24 ind = findcross(diff(x),0)+1;
Comments or corrections to the WAFO group