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

- findcross
- diff

Finds indices to level v up and downcrossings of a vector | |

Difference and approximate derivative. |

- dat2tp

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;

Mathematical Statistics

Centre for Mathematical Sciences

Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for