필터 지우기
필터 지우기

Calculate the area under histogram

조회 수: 32 (최근 30일)
Ali nouri
Ali nouri 2020년 5월 7일
답변: Ameer Hamza 2020년 5월 7일
Hi Guys
I am using the below code to get a histogram plot over differenet data.
I want to know, how can I calculate the area below the histogram, and if i want that all area shall be equal to 1, then how can I do it?
Thanks in advance.
n = 50;
figure(3)
XEU100 = histogram(Delta_EU100,n);
hold on
XEU90 = histogram(Delta_EU90,n);
title('Mismatch distribution');
xlabel('Normalized mismatch power')
ylabel('P(\Delta)')

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 7일
You can find the area under the histogram by summing all heights and multiply by the bin width
x = rand(1000,1);
h = histogram(x);
area = sum(h.Values)*h.BinWidth;
To get a histogram with the total area equal to 1. You can specify normalization
x = rand(1000,1);
h = histogram(x, 'Normalization', 'pdf');

추가 답변 (0개)

카테고리

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