4

以下の正規化された密度 p(x) を再現する必要がありますが、指定されたコードは正規化された PDF を生成しません。

x の p のプロット

clc, clear
% Create three distribution objects with different parameters
pd1 = makedist('Uniform','lower',2,'upper',6);
pd2 = makedist('Uniform','lower',2,'upper',4);
pd3 = makedist('Uniform','lower',5,'upper',6);
% Compute the pdfs
x = -1:.01:9;
pdf1 = pdf(pd1,x); 
pdf2 = pdf(pd2,x); 
pdf3 = pdf(pd3,x); 
% Sum of uniforms
pdf = (pdf1 + pdf2 + pdf3);
% Plot the pdfs
figure;
stairs(x,pdf,'r','LineWidth',2);

正規化された混合PDFを合計で単純にスケーリングして計算すると、上記の元の図と比較して正規化された確率が異なります。

pdf = pdf/sum(pdf);
4

1 に答える 1