The localmax and localmin functions are used to find local maxima and minima in 2D or 3D data sets.
For 2D data sets, the x data is recorded in the first column of matrix M1 and its associated response is in the second column.
For 3D data sets, the x and y data is recorded in the vector x and y respectively, and its associated response is in matrix M2.
• localmax(M1, [w])—Returns a two-column matrix of the x and y values for each maximum found in the second column of matrix M1.
• localmax(x, y, M2, [w])—Returns a three-column matrix of the x, y and z values for each maximum found in matrix M2.
• localmin(M1, [w])—Returns a two-column matrix of the x and y values for each minimum found in the second column of matrix M1.
• localmin(x, y, M2, [w])—Returns a three-column matrix of the x, y and z values for each minimum found in matrix M2.
When the optional window width w is greater than 1, each point in the data must be greater than the surrounding (2w + 1) points to be considered a local maximum to avoid false positives from noise.
Arguments
• M1 is a real n x 2 matrix.
• w (optional) is an integer ≥ 1, and its default value is 1.
• x, y are real vectors.
• M2 is a real matrix with the same number of rows as vector x, and the same number of columns as vector y has rows.