How to fit a data with mixture of gaussian distribution?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!