I have a problem with wblfit and wblpdf.
1 view (last 30 days)
Show older comments
My fitting result are shown on the following image.
Full code is almost same to the Matlab tutorial code except binWidth, binCtrs, and life.
paramEsts = wblfit(life); % 0.1663, 0.6049
n = length(life); %50
binWidth = 0.032;
binCtrs = 0.032:binWidth:5;
counts = hist(life, binCtrs);
prob = counts / (n * binWidth);
bar(binCtrs,prob,'hist');
xlabel('Time'); ylabel('Probability Density'); ylim([0 4]);
xgrid = linspace(0,5,100);
pdfEst = wblpdf(xgrid,paramEsts(1),paramEsts(2));
line(xgrid,pdfEst)
Life is: 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0320 0.0640 0.0640 0.0640 0.0640 0.0640 0.0640 0.0640 0.0640 0.0960 0.0960 0.1280 0.1280 0.1280 0.3520 0.3520 0.4160 0.6400 0.6720 0.8960 0.9280 1.1520 3.1680 4.4480
My question here is why the histgram is not integrated to 1? If I use
prob = counts / sum(counts);
isstead of
prob = counts / (n * binWidth);
The result is like the following:
Fitting is same and the area of histogram was integrated to 1. What's wrong here? And I found that even tutoral histogram was integrated to 0.5, not to 1.
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!