1% Generation of the quantiles of the Bernoulli distribution at 99.9%
2% related to phy error model test
3
4n = 1000;
5p_vect = [0.35 0.11 0.02 0.3 0.55 0.14];
6for i=1:length(p_vect)
7  p = p_vect(i)
8  cdf = 0.0;
9  kmin = 0.0;
10  kmax = 0.0;
11  lambda = n * p
12  for k=1:n
13    pk = bincoeff(n,k)* p^k * (1-p)^(n-k);
14    cdf = cdf + pk;
15    if cdf > 0.0005 & kmin == 0.0
16      kmin = lambda - k
17    end
18    if cdf > 0.9995 & kmax == 0.0
19      kmax = k - lambda
20    end
21  end
22
23end
24
25
26