probability of occurence of a specific value
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi all! I have a question concerning the probability of occurence of a specific value. I have a set of precipitation data and would like to find the frequency histogram for precipitation values equal to zero. is there someone here who is able to solve this easy problem? :) thank you
댓글 수: 0
답변 (3개)
Guillaume
2015년 3월 10일
You must have at least two bins for the histogram functions, you could just set the threshold of the second bin to something very small:
h = histc(data, [0 0.00001]);
But if you really just want the number of values equal to 0:
num0 = sum(data == 0);
%or num0 = sum(abs(data < 0.00001)) if you want to include values very close to 0
댓글 수: 5
Guillaume
2015년 3월 10일
moreover I would like to plot a relative frequency histogram instead of the normal one
I assume that's what you want:
precipitationhistogram = precipitationhistogram / sum(precipitationhistogram);
precipitationhistogram = histcounts(filteredprecipitation, [0 0.1 1 3 10 Inf], 'Normalization', 'probability');
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!