Converting a weibull figure to a histogram
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Youssef Chehade
le 17 Mar 2021
Réponse apportée : Jeff Miller
le 17 Mar 2021
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 commentaires
Réponse acceptée
Jeff Miller
le 17 Mar 2021
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 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!