How to fit a data with mixture of gaussian distribution?

3 vues (au cours des 30 derniers jours)
Amr Hashem
Amr Hashem le 10 Jan 2017
Commenté : Amr Hashem le 12 Jan 2017
I have a failure data, and i am trying to find the best probability distribution to fit this data.
I try many PDF like generalized extreme value, normal , weibull,...etc. but i couldn't apply mixture gaussians distribution.
I use this code
[ndata text alldata] = xlsread('battery2.xlsx','li ion');
[R2,C2]=size(alldata);
Life = ndata(:,72);
A=round(Life);
[val,idxC, idxV] = unique(A);
n = accumarray(idxV,1);
m= [n idxC] ;
y = [val n];
binWidth = 1;
binCtrs = 0:binWidth:134
counts = hist(Life,binCtrs);
nu = length(Life);
prob = counts / (nu * binWidth);
h4= figure;
bar(binCtrs,prob,'hist');
paramEstsmg = gmdistribution.fit(Life,5); %estimate parameter
xgrids = linspace(0,135,100); % extend the x-axis
pdfEstsmg = pdf(paramEstsmg,xgrids); hold on;
line(xgrids,pdfEstsmg,'color','r', 'LineWidth',2)
xzero= cdf.inv(0.01,paramEstsmg); %inverse cumulative distribution function
yzero=0;
after running the code i got this error:
Error using checkdata (line 18)
X must be a matrix with 1 columns.
Error in gmdistribution/pdf (line 18)
checkdata(X,obj);
Error in Li_ion_mixture_gaussian (line 71)
pdfEstsmg = pdf(paramEstsmg,xgrids);
This is the generalized extreme value best fit i tried. which works well
any help!! Thanks in advance.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by