Peak "coordinates of a histogram

조회 수: 4 (최근 30일)
Damiano Capocci
Damiano Capocci 2019년 3월 9일
댓글: Damiano Capocci 2019년 3월 13일
Hi, I want to study the histogram of an array. This array has only one peak, I want to determine the bin related to the peak. I have just tried ksdensity() and then findpeaks() but if I want a good precision the hig number of points of ksdensity makes the process slow. Please could you tell me how to find out the bin related to the peak? A good hint could be to transform the histogram into a vector.

채택된 답변

Star Strider
Star Strider 2019년 3월 9일
Not at all certain what question you are asking. If you want to know the indices of the data assigned to each bin, see the histcounts (link) documentation on Determine Bin Placement (link).
If you are not using histcounts, consult the appropriate documentation for the function.
  댓글 수: 1
Damiano Capocci
Damiano Capocci 2019년 3월 13일
yes it works, after histcounts I do :
%V is the vector%
[x,y]=max(V)

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

추가 답변 (1개)

Steven Lord
Steven Lord 2019년 3월 10일
Are you creating the histogram (the graphics object) or binning the data using histcounts?
In the former case. retrieve the BinCounts and BinEdges properties from the histcounts object. Use max to identify the maximum count and its location, and index into the edges vector to identify the edges of that bin.
In the latter case, do the same thing with the first two outputs of histcounts.
  댓글 수: 1
Damiano Capocci
Damiano Capocci 2019년 3월 12일
I create the histogram from an array. However i do not know histcounts.Anyway I will try.

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

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by