How do I find the local maxima of a vector?

 Respuesta aceptada

Doug Hull
Doug Hull el 18 de En. de 2011
You can use the following one-line function to determine the indices of the local maxima.
function index = localmax(x)
index = find( diff( sign( diff([0; x(:); 0]) ) ) < 0 );
[from the MATLAB FAQ of Ancient Times]

Más respuestas (0)

Categorías

Productos

Etiquetas

Preguntada:

el 18 de En. de 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by