我有多个直方图,我想叠加在彼此之上,但我不知道该怎么做。我发现了下面的代码,但我不知道如何修改它以在循环上运行,而不是仅仅运行两个直方图。如何覆盖matlab中的直方图
data1 = randn(100,1); % data of one size
data2 = randn(25, 1); % data of another size!
myBins = linspace(-3,3,10); % pick my own bin locations
% Hists will be the same size because we set the bin locations:
y1 = hist(data1, myBins);
y2 = hist(data2, myBins);
% plot the results:
figure(3);
bar(myBins, [y1;y2]');
title('Mixed size result');
或什么是比较直方图的一种更好的方式,如果他们超过10或20
持有,持有了吗? – 2013-05-13 10:18:02
在您的代码中,yBar总是有相同的长度(10),但我应该怎么做(可能是matlab中的单独条)(http://stackoverflow.com/questions/16313392/separate-bars-in-matlab) – Shai 2013-05-13 11:25:17