Finding several peaks in a vector

18 Ansichten (letzte 30 Tage)
maytal melchior
maytal melchior am 12 Dez. 2020
Kommentiert: Star Strider am 17 Feb. 2023
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 Kommentare
Will Reeves
Will Reeves am 17 Feb. 2023
Bearbeitet: Will Reeves am 17 Feb. 2023
"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 am 17 Feb. 2023
Your concerns may already have been mentioned. (I don’t follow that thread closely.)

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sai Veeramachaneni
Sai Veeramachaneni am 15 Dez. 2020
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.

Community Treasure Hunt

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

Start Hunting!

Translated by