Converting a weibull figure to a histogram
13 ビュー (過去 30 日間)
古いコメントを表示
I created a weibull distribution based on hours of the day. I would like to have a histogram to further show these results. How can I obtain the histogram?
The code for the weibull distribution is:
x=0:1:23;
y=wblpdf(x,3,2);
y_new=round(4000*y);
y_new=circshift(y_new,16);
figure(1)
plot(x,y_new)
I tried using histogram(y_new) and histfit(y_new), even adjusting number of bins, but the figures I got were very different
Any tips please?
0 件のコメント
採用された回答
Jeff Miller
2021 年 3 月 17 日
histogram takes a list of data values (your x's) and tabulates how often each occurs. if you don't already have data values, you might generate some randomly, e.g.
sample_data = wblrnd(3,2,10000,1);
histogram(sample_data); % 'normalization','pdf');
The extra (now commented) parameters on the histogram command will put the histogram heights on the same scale as the pdf values from wblpdf.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!