diameter = [0.995, 0.995, 0.996, 0.997, 0.998, 0.999, 1.000, 1.001, 1.002, 1.003, 1.004, 1.005, 1.005]; freq = [1, 0, 8, 9, 15, 25, 22, 9, 7, 3, 1, 0];

figure; histogram(diameter, 'BinWidth', 0.001, 'BinLimits', [0.995, 1.005], 'FaceColor', 'b', 'FaceAlpha', 0.5); xlabel('Diameter'); ylabel('Frequency'); title('Histogram of Diameter');

% Add frequency counts to the bars hold on; for i = 1:length(freq) text(diameter(i)+(0.0005/2), freq(i)+1, num2str(freq(i)), 'HorizontalAlignment', 'center'); end hold off;

MATLAB Histogram: Diameter Distribution with Frequency Counts

原文地址: https://www.cveoy.top/t/topic/nW6b 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录