私が持っているランダムプロセスの実現の確率密度関数を推定するために、Matlab 関数「hist」を使用しています。
私は実際には:
1) h0 のヒストグラムを取る
2) 1 を得るためにその面積を正規化する
3) 正規化された曲線をプロットします。
問題は、使用するビンの数に関係なく、ヒストグラムが 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
そして、私が得るプロットは次のとおりです。