【发布时间】:2014-06-03 20:31:21
【问题描述】:
我正在使用 Matlab 函数“hist”来估计我所拥有的随机过程实现的概率密度函数。
其实我是:
1) 取h0的直方图
2) 对其面积进行归一化以获得 1
3) 绘制归一化曲线。
问题是,无论我使用多少个 bin,直方图永远不会从 0 开始,也永远不会回到 0,而我真的很喜欢这种行为。
我使用的代码如下:
Nbin = 36;
[n,x0] = hist(h0,Nbin);
edge = find(n~=0,1,'last');
Step = x0(edge)/Nbin;
Scale_factor = sum(Step*n);
PDF_h0 = n/Scale_factor;
hist(h0 ,Nbin) %plot the histogram
figure;
plot(a1,p_rice); %plot the theoretical curve in blue
hold on;
plot(x0, PDF_h0,'red'); %plot the normalized curve obtained from the histogram
我得到的情节是:
【问题讨论】:
-
看看 histc (
bar(histc(x,[h0:1/nbins:2])))
标签: matlab histogram probability probability-density