How do I find the local maxima of a vector?

 採用された回答

Doug Hull
Doug Hull 2011 年 1 月 18 日

0 投票

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]

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by