How can I find the percentage of the overlap of two histograms in Matlab?

조회 수: 16 (최근 30일)
Zahra
Zahra 2013년 11월 5일
답변: Image Analyst 2014년 11월 21일
I try to plot two histograms and I need to know quantitavely what is the area and percentage of overlap of these two histograms.
  댓글 수: 2
Image Analyst
Image Analyst 2013년 11월 5일
Do the bins cover the same ranges? Like they're both 5 units wide and have edges in the same locations?
Filippo
Filippo 2014년 11월 21일
Assuming they do cover the same ranges... can anyone answer this question? I'm looking too!

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

답변 (1개)

Image Analyst
Image Analyst 2014년 11월 21일
I'd put each histogram into one row and take the min and the max.
bothHistograms = [hist1; hist2];
minCounts = min(bothHistograms, [], 1);
maxCounts = max(bothHistograms, [], 1);
Then get the ratio of the min value for each bin to the max value for each bin:
ratios = minCounts ./ maxCounts;
If you want the average percentage coverage over all bins, take the mean over all bins:
meanPercentage = mean(ratios);

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by