clc
clear
n=10^4;
k=100;
mu=2;
sigma=1;
Xn=mu+sigma*randn(n,k);
t0=mu+0.5;
F=normcdf(t0,mu,sigma)
T=(Xn<t0);
Fn=mean(T);
g=0.99;
t=norminv((1+g)/2);
sn=std(T);
dn=t*sn/(sqrt(n));
Fn1=Fn+dn;
Fn2=Fn-dn;
Y0=0:0.05:k;
l=sum(Fn1<F)+sum(Fn2>F)
plot(1:1:k,Fn1,'g-*',1:1:k,Fn2,'r-*',Y0,F,'b-')