필터 지우기
필터 지우기

Problem in finding PDF of a set of samples

조회 수: 1 (최근 30일)
may
may 2013년 9월 30일
댓글: Image Analyst 2013년 10월 1일
I want to get PDF of a set of samples, A, from its histogram:
[n,x] =hist(A,Number_bins);
when I use the following code:
pdf=n/sum(n(:));
with different number of bins I get different results, to fix it I use this code
pdf=n/sum(n(:))/diff(x(1:2));
but some of numbers in pdf would be greater than one! (the probability should not be greater than one)
I really don't understand where the problem is. I would appreciate if you you could help me. Thank you.

답변 (1개)

Image Analyst
Image Analyst 2013년 9월 30일
Of course the PDF is different if you have different bin sizes. But most important is how you plan on using the PDF. What do you plan on doing with it? I think n/sum(n) is fine - you just have to know what you're dealing with when it comes time to use it. It tells you the probability of a sample falling into that bin.
  댓글 수: 3
may
may 2013년 9월 30일
편집: may 2013년 9월 30일
I edited the question, thanks.
Image Analyst
Image Analyst 2013년 10월 1일
Don't divide by the diff. And of course the PDF will vary according to the number of bins. Computers are digital - you can't have an infinite number of bins. It can't be continuous. It must be quantized and since the number of counts in the quantized pdf must equal the number of elements in your array, the value per bin must be different. My other question, about what you plan on doing with it, remains unanswered.

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by