close all
clear all


 disp('Goodness of Fit: Kolmogorov for Simulated Data')
 lw = 2.5; 
 set(0, 'DefaultAxesFontSize', 16);
 fs = 15;
 msize = 10;
 rand('state', 0);
%===================================
x = exprnd(1/2,[1,30]);
% form theoretical cdf
t = 0:0.01:20;
y = expcdf(t,1/2);
cdf = [t' y'];
[decision, pval, KSstat, critValue] = kstest(x, cdf, 0.01, 0)
        %decision  =     0
        %pval  = 0.8622
        %KSstat  =  0.1049
        %critValue  =  0.2899
%===================================
xx = 0:0.01:3;
plo = cdfplot(x); set(plo,'LineWidth',2);
hold on
plot(xx,expcdf(xx, 1/2),'r-','LineWidth',2);
legend('Empirical','Theoretical Exponential',...
       'Location','SE')
% print -depsc 'C:\Springer\Goodness\Goodnesseps\ksexp.eps'