【问题标题】:Uniform Density histfit均匀密度组织拟合
【发布时间】:2012-05-13 05:51:28
【问题描述】:

如何使用 histfit() 在直方图上绘制均匀密度?有一个命令可以为正态分布和其他一些命令执行此操作,所以我必须操纵其中一个以使其均匀吗?

示例:

s4 = randn(50,1);
counts = [];
[counts(1,:) freq] = histc(s4, [-inf,-3]);
for n = 2:7
    [counts(n,:) freq] = histc(s4, [-5+n,-4+n]);
end
[counts(8,:) freq] = histc(s4, [3,inf]);
counts(1:8)
histfit(s4).

如何实现统一直方图的 histfit?

s = rand(50,1);
[count freq]= hist(s,5);
histfit(s);
count

【问题讨论】:

  • 换句话说,我正在寻找的是直方图顶部的直线(均匀)而不是钟形曲线(正常)。

标签: matlab histogram


【解决方案1】:

如果您想要的只是直方图顶部的一条水平线看起来像您给出的示例,请尝试:

s4 = randn(50,1);
[N,X] = hist(s4,sqrt(numel(s4)));
bar(X,N);
hold on
plot([min(s4) max(s4)],[mean(N),mean(N)],'r','LineWidth',2);

这给了我一个直方图,在 bin 值的平均值处有一条水平线。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-10-11
    • 1970-01-01
    • 1970-01-01
    • 2015-04-19
    • 2013-09-04
    • 1970-01-01
    • 2013-06-25
    • 1970-01-01
    相关资源
    最近更新 更多