How to find the maximum of a normalized fit of a histogram
조회 수: 14 (최근 30일)
이전 댓글 표시
I'd like to find, point, and label the maximum of a normalized fit curve on a histogram
The code I'm using to build the histogram/fit curve is:
Average_Insert_Time = mean(All_Data); %Find average of data for random codon to mark on histogram
Histogram = histfit(All_Data,5000,'normal');
hold on
xlim([0 (Average_Insert_Time*2)]);%places average at center of graph
line([Average_Insert_Time, Average_Insert_Time], ylim, 'LineWidth', 2, 'Color', 'g'); %add average vertical
hold off
It produces a figure that looks like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/245601/image.png)
I want to place a marker on the maximum value of this normalized distribution, which then denotes the Y-value
댓글 수: 0
답변 (2개)
Jeff Miller
2019년 11월 7일
Try this:
dist = Histogram(2)
maxnorm = max(dist.YData);
line([min(dist.XData) max(dist.XData)], [maxnorm maxnorm], 'LineWidth', 2, 'Color', 'g');
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!