Finding several peaks in a vector

조회 수: 17 (최근 30일)
maytal melchior
maytal melchior 2020년 12월 12일
댓글: Star Strider 2023년 2월 17일
I want to write a code that takes a vector and finds the number of "peaks", maximums or minimums, when there are several peaks.
The vector could be a different range everytime.
Also, if possible, I would like the output to give me the location in the vector.
  댓글 수: 3
Will Reeves
Will Reeves 2023년 2월 17일
편집: Will Reeves 2023년 2월 17일
"islocalmax" sure, "findpeaks"? it's in the signal processing toolbox...
I can't justify to my company the ongoing price of an entire toolbox for a single function. (As a warning, I believe Mathworks need to start rolling in some of the basic functionality into base Matlab. I'm constantly being pulled in the direction of python by my colleagues, I'm not a fan really, but at some point they're going to win)
Generic data exploration tools really should be included with Matlab.
Star Strider
Star Strider 2023년 2월 17일
Your concerns may already have been mentioned. (I don’t follow that thread closely.)

댓글을 달려면 로그인하십시오.

답변 (1개)

Sai Veeramachaneni
Sai Veeramachaneni 2020년 12월 15일
Hi,
You can use islocalmax and islocalmin functions to calculate locations of local maximums and minimums respectively.
You can use sum function over islocalmax and islocalmin to count number of peaks in the given vector.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by