Converting a weibull figure to a histogram
4 次查看(过去 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!