close all
clear all
 disp('Catterpilar')
  lw = 2; 
  set(0, 'DefaultAxesFontSize', 15);
  fs = 15;
  msize = 10;
% end of preabmle--------------------------------------
 n=40;
 alpha=0.05;
randn('state',40)
%-------------------------------------
for i = 1:100
    sample = 10+ 4*randn(1,n);
    xbar = mean(sample);
    s = std(sample);
    LB(i) = xbar - tinv(1-alpha/2, n-1) * s/sqrt(n);
    UB(i) = xbar + tinv(1-alpha/2, n-1) * s/sqrt(n) ; 
    a = 1; b='k-';
    if( LB(i) > 10 | UB(i) < 10 ) 
        a=2; b='r-';
          i
    end
plot( [i, i], [LB(i), UB(i)], b,'LineWidth',a);
   
hold on
end
plot([1, 100],[10, 10],'r-')
hold off
xlabel('Simulation number')
%print -depsc 'C:/Springer/Estim/Estimeps/hundredcis.eps'

