find the best fit distribution that fits the data

3 views (last 30 days)
how could I find the best probability distribution that fits a failure rate data?
I try:
val=[0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;]; % time
n=[4;7;9;7;14;12;18;29;25;30;39;40;33;46;46;59;62;60;62;] % failure rate
Exponential distribution
ex=expfit(n); % n estimate parameters maximum likelihood exponential
Ee=exppdf(n,ex); % exponential pdf
figure
plot(val,n/trapz(val,n),'ro');hold on %resize/scaling the data
plot(val,Ee,'-g')
Poisson distribution
[l,lci]=poissfit(n); % n estimate parameters maximum likelihood poisson
p=poisspdf(n,l); % poisson pdf
stem(val,p,'k-')
Normal distribution
pd = fitdist(n,'Normal')
ynormal = pdf(pd,n);
plot(val,ynormal,'m-','LineWidth',2)
axis([-1 19 0 0.12]);
grid on
AAY=legend('data','Exponential','poisson','normal'); %
which produce this figure:
NO BEST FIT in the figure.
How I can modify the code to find the best fit distribution?

Answers (0)

Community Treasure Hunt

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

Start Hunting!