Relative frequency y-axis using the histfit function
Mostra commenti meno recenti
Dear,
I am trying to plot two histograms with weibull probability density curves on the same figure.
However, I am having difficulty changing the y axis from absolute frequency to relative frequency.
If it was just a histogram, I could easily recalculate the y-axis values and change the yticklabel values. However I need to plot two histograms on the same figure, and the two datasets do not have the same length.
Below is a reproducible example of how I am currently doing.
data1 = wblrnd(0.4,2,[1000,1]); data1 = data1(data1 <= 1);
data2 = wblrnd(0.4,2,[900,1]); data2 = data2(data2 <= 1);
h1 = histfit(data1, 10, 'weibull')
hold on
h2 = histfit(data2, 10, 'weibull')
h1(2).Color = [.5843 .8157 .9882]
h2(2).Color = [.9100 .4100 .1700]
alpha(h1(1),.5)
alpha(h2(1),.5)
uistack(h1(2),'top')
Below is the picture I am currently generating. I want the y axis to be the relative frequency, not the absolute frequency or probability density.

Could someone help me with this?
Thank you very much in advance.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Histograms in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!