如果要显示在对应的区间,可以手动用set命令把坐标轴的显示改成对应的区间,如下:
A=[311 345 480 665 1039];
n=hist(A,[214 301.5 426.5 603.5 853.5 1207]);
n=diag(n);
bar(n,'stack');
set(gca,'XTickLabel',{'178-250','250-353','353-500','500-707','707-1000','1000-1414'});
A=[311 345 480 665 1039];
n=hist(A,[214 301.5 426.5 603.5 853.5 1207]);
n=diag(n);
bar(n,'stack');
set(gca,'XTickLabel',{'178-250','250-353','353-500','500-707','707-1000','1000-1414'});