下一个代码将完成这项工作,但您需要更改轴的Xticklabels以使它们显示异常值的实际值。
A=rand(1000,1)*0.1; A(1:10)=10; % modify the data for plotting pourposes. Get the outliers closer expected_maximum_value=1; % You can compute this useg 3*sigma maybe? distance_to_outliers=0.5; outlier_mean=mean(A(A>expected_maximum_value)); A(A>expected_maximum_value)=A(A>expected_maximum_value)-outlier_mean+distance_to_outliers; % plot h=histogram(A,'BinWidth',0.01) %% trick the X axis ax=gca; ax.XTickLabel{end-1}=[ax.XTickLabel{end-1} '//']; ax.XTickLabel{end}=['//' num2str(outlier_mean)];