Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
histogram vector with deltaN specified
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a vector x
x = [1.7 2.2 1.7 3.0 2.2]
also I have a deltaN associated with each value in x
deltaN = [0.1 1.0 3.0 0.7 0.7]
How can I instruct Matlab to increase the count in bin corresponding to x(i) by deltaN(i), not 1?
댓글 수: 0
답변 (2개)
Image Analyst
2017년 10월 22일
What is deltaN? You can specify the edges of the bins if that's what you're asking about. See the documentation for histogram() or histcounts().
댓글 수: 5
Guillaume
2017년 10월 23일
There are no weighted histogram function in matlab as far as I know. It's not really hard to implement:
x = [1.7 2.2 1.7 3.0 2.2];
deltaN = [0.1 1.0 3.0 0.7 0.7];
[~, ~, bin] = histcounts(x); %add whichever option you want to histcount
h = accumarray(bin', deltaN')
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!