我正在使用Matlab(更好的主意)。
我需要将直方图的频率乘以标量值(对于每个bin)。
我在similar question中尝试了这种方法,但它是为hist而不是直方图函数定义的。
这是我原来需要增加的分布:
此外,当我完成这部分时,我将有更多的直方图,我需要总结成一个直方图。那我该怎么做?他们可能有不同的范围。
答案 0 :(得分:2)
文档clearly explains如何使用hist
复制histogram
的行为。
例如:
A = rand(100, 1);
h = histogram(A);
figure
h_new = histogram('BinCounts', h.Values*2, 'BinEdges', h.BinEdges);
生成以下直方图:
答案 1 :(得分:2)
您可以像这样修改Bincounts:
X = normrnd(0,1,1000,1); % some data
h = histogram(X,3); % histogram with 3 bins
h.BinCounts = h.Values.*[3 5 1]; % scale each bin by factor 3, 5 and 1 respectively