Converting a weibull figure to a histogram

9 visualizaciones (últimos 30 días)
Youssef Chehade
Youssef Chehade el 17 de Mzo. de 2021
Respondida: Jeff Miller el 17 de Mzo. de 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?

Respuesta aceptada

Jeff Miller
Jeff Miller el 17 de Mzo. de 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.

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by