%Tsetse Fly
disp('Tsetse flies and Glossina morsitans')
  lw = 3; 
  set(0, 'DefaultAxesFontSize', 15);
  fs = 15;
  msize = 10;
% end of preabmle--------------------------------------

microns = 15:35;
freq = [ 7   31 148   230  326   252   237   184   143  ...
  115   130   110  127  133  113  96  54   44   11   7   2 ];
sample =[];
for i = 1:21    %make simple sample
    sample =[sample; repmat(microns(i),freq(i),1)];
end
figure(1)
bar(microns, freq)
mix = gmdistribution.fit(sample,2);
mix.mu
     %ans =  26.523     19.493
mix.Sigma
     %ans(:,:,1) =10.113   ans(:,:,2) = 3.141
mix.PComponents    
     %ans = 0.45551      0.54449

figure(2)
bar(microns, freq/2500)
hold on
           [u v]=fplot(@(x)pdf(mix,[x]),[10 40]);
h=plot(u, v);
           set(h,{'LineWidth'},{lw},{'Color'},{[0.5 0.5 0.5]})
           hold off
%print -depsc 'C:/Springer/Norm/Normeps/Mixture2Tsetse.eps'