matlab学习之数据分析

clear all
load count.dat
c3 = count(:,3); % 第三列数据
c3NaNCount = sum(isnan(c3));
h = histogram(c3,10); % 直方图,横坐标为值,纵坐标为组数
N = max(h.Values); % 求最大值

mu3 = mean(c3); % 求平均值
sigma3 = std(c3); % 求均方差
hold on
plot([mu3 mu3],[0 N],'r','LineWidth',2) % Mean
X = repmat(mu3+(1:2)*sigma3,2,1);
Y = repmat([0;N],1,2);
plot(X,Y,'Color',[255 153 51]./255,'LineWidth',2) % Standard deviations
legend('Data','Mean','Stds')
hold off

猜你喜欢

转载自blog.csdn.net/seek97/article/details/90159203