フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

histogram vector with deltaN specified

1 回表示 (過去 30 日間)
Viesturs Veckalns
Viesturs Veckalns 2017 年 10 月 22 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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?

回答 (2 件)

Image Analyst
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 件のコメント
Walter Roberson
Walter Roberson 2017 年 10 月 22 日
Count regularly and then multiply the bin counts by your weights.
Viesturs Veckalns
Viesturs Veckalns 2017 年 10 月 23 日
1. The histogram will be displayed incorrectly
2. This will require me to count the weights myself

Guillaume
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')

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by