%MatLab实现数据分布检验的程序?
%拿到数据的时候,首先要判断以下这批数据服从什么分布,下面是matlab程序/?

function f=p_judge(A,alpha)
%Usage:p_judge(A,0.05)
%?本程序用于判别所给数据源在置信率为0.05时的概率分布形式。A的形式为n×1。?
% A = [51.1250000000000,49.2217314400000,51.0812304600000,48.6170860200000;110.750000000000,163.569126000000,203.567000500000,61.8814443700000;58.5500000000000,52.6887084700000,60.8280363000000,44.1092841400000;56.0250000000000,103.172618000000,141.294867100000,33.3938223100000;52.3250000000000,52.1700314300000,38.1471872500000,62.3095836200000;120.725000000000,123.716588300000,102.750387400000,143.176841300000;75.9000000000000,78.8701627000000,63.0485193300000,93.6645751200000;107.975000000000,88.6559143800000,89.1028235100000,90.4736076700000;99.8250000000000,96.0477679000000,86.9148857700000,105.150718900000;83.1500000000000,80.0437540600000,91.9936353600000,51.4990802200000;89.0750000000000,79.0311160700000,55.5209538400000,98.6677572200000;77.1250000000000,107.272523200000,76.8931418500000,133.063459300000;46.8500000000000,55.5778733000000,33.9552336900000,71.9286195900000;76.7250000000000,73.6725212300000,80.6801840900000,66.9625975700000;36.5250000000000,36.7388479500000,46.4181226000000,17.4303878600000;81.2750000000000,121.841003500000,161.931434500000,54.4334214300000;49.3250000000000,53.3620375500000,70.8682989000000,20.7092021200000]
% for i = 1:4
%       p_judge(A(:,i),0.05)
% end



[mu,sigma]=normfit(A);
p1=normcdf(A,mu,sigma);
[H1,s1]=kstest(A,[A,p1],alpha);
n=length(A);
if H1==0
disp('该数据源服从正态分布。')
else
disp('该数据源不服从正态分布。')
end

% phat=gamfit(A,alpha);
% p2=gamcdf(A,phat(1),phat(2));
% [H2,s2]=kstest(A,[A,p2],alpha)
% if H2==0
% disp('该数据源服从γ分布。')
% else
% disp('该数据源不服从γ分布。')
% end
% 
% lamda=poissfit(A,alpha); 
% p3=poisscdf(A,lamda);
% [H3,s3]=kstest(A,[A,p3],alpha)
% if H3==0
% disp('该数据源服从泊松分布。')
% else
% disp('该数据源不服从泊松分布。')
% end
% 
% mu=expfit(A,alpha);
% p4=expcdf(A,mu);
% [H4,s4]=kstest(A,[A,p4],alpha)
% if H4==0
% disp('该数据源服从指数分布。')
% else
% disp('该数据源不服从指数分布。')
% end
% 
% [phat, pci] = raylfit(A, alpha) ;
% p5=raylcdf(A,phat);
% [H5,s5]=kstest(A,[A,p5],alpha)
% if H5==0
% disp('该数据源服从rayleigh分布。')
% else
% disp('该数据源不服从rayleigh分布。')
% end