finding all local minima of histogram

12 views (last 30 days)
Rafia Mansoor
Rafia Mansoor on 27 Sep 2019
Commented: Bjorn Gustavsson on 27 Sep 2019
I have a histogram and I need to find all the local minima of that histogram.
  1 Comment
Rafia Mansoor
Rafia Mansoor on 27 Sep 2019
through islocalmin we can find all the local minimas. but that is compatible with 2017 version of matlab and not with the previsous version of matlb

Sign in to comment.

Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 27 Sep 2019
If you read the help of the hist function you'll find:
N = HIST(Y) bins the elements of Y into 10 equally spaced containers
...and
[N,X] = HIST(...) also returns the position of the bin centers in X.
So that gives you a means to get both the histogram-counts and the centre-position.
From there you need to find the local maxima. That should be rather easy (provided you have no
exact repeat values in N at the local minima), use diff and check where that goes from negative to positive.
  4 Comments
Rafia Mansoor
Rafia Mansoor on 27 Sep 2019
this was not my homework. That's part of my research well I have found the correct answer.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!