% This outputs a histogram with lines at the mean,
% and +/- 1 standard deviation levels.
% It does not normalize the data
% nor apply a normal Gaussian bell curve over it.
figure(1)
[Y,X] = hist(DATA,n);
sigma = std(DATA);
xbar = mean(DATA);
bar(X,Y)
y = ylim;
line([1 1]*(xbar-sigma),y)
line([1 1]*xbar,y)
line([1 1]*(xbar+sigma),y)
1 回答
我使用
line
函数:我从来没有使用
histfit
函数,但我怀疑它是在你的直方图中进行正态分布的最小二乘类型拟合 . 除非您的数据集具有无限数量的数据点并且它是真正正态分布的,否则这将导致与使用std
计算的标准偏差不同 .