Short Packet Communication Toolbox
Short Packet Communication Toolbox
Version 0.2
e-mail: [email protected]
September 2, 2016
Abstract
1
Contents
Contents 2
1 Motivation 5
2
CONTENTS 3
Bibliography 53
Chapter 1
Motivation
5
Chapter 2
General info:
Maintainer: Y. Polyanskiy <[email protected]>
Main references: [1]
Example: See Fig. 2.1
Channel model:
Yj = Xj + Zj , j = 1, . . . , n
Codewords are real: xj R, j = 1, . . . , n
Noise: Zj N (0, 1) iid.
7
8 CHAPTER 2. THE REAL AWGN CHANNEL
1.8
1.6
1.4
1.2
Capacity
Rate, R
1
Converse (|X|2 = nP)
Normal approximation
0.8 kappabeta achievability
Gallager random coding
0.6
0.4
0.2
0
0 100 200 300 400 500 600 700 800 900 1000
Blocklen, n
Block-memoryless Rayleigh
fading channel, no CSI
General info:
Yk = Xk Hk + Wk , k = 1, . . . , l , (3.1)
where Yk , Wk Cnc mr , Xk Cnc mt and Hk Cmt mr . The noise
Wk and the channel gain Hk are independent and have independent
CN (0, 1) entries. Neither the transmitter nor the receiver are aware of
the realizations of the fading matrix Hk .
The power constraint is defined per coherence interval, i.e., each codeword
C consists of l subcodewords C1 , . . . , Cl that must satisfy:
tr CH
k Ck = nc , k = 1, . . . , l.
snrdB SNR in dB
T channel coherence time (expressed in channel uses)
L number of independent fading realizations spanned by each
codeword
Mt number of tranmsmit antennas
11
12 CHAPTER 3. BLOCK-MEMORYLESS RAYLEIGH FADING (NO CSI)
1.5
1 Alamouti
0.5
0
1 2 4 7 14 21 28 42
time-frequency diversity branches l (log scale)
Figure 3.1: Maximum coding rate R (nc , l, , ) for 22 MIMO system operating
over a Rayleigh block-fading channel with coherence time nc . Each packet
spans l coherence intervals. The packet size is 168 channel uses. The packet
error rate is = 103 . The SNR is = 6 dB.
function [R,current_eps,current_prec]
=MC_USTM_2x2(snrdB,T,L,Mtalt,epsilon,prec,pow_all,filename)
function [R,current_eps,current_prec]
=MC_USTM_4x4(snrdB,Mtalt,T,L,epsilon,prec,pow_all,filename)
These two functions compute the right-hand side of [2, Eq. (41)] for fixed input
diagonal matrices {k }lk=1 and fixed auxiliary output distribution (which is
parameterized by the number of effectively used transmit antennas Mtalt that
result in this distribution), for the case mt = mr = 2 and mt = mr = 4. To
obtain the actual converse bound, a further optimization over these parameters
need to be performed. This is discussed in the next section. The parameter
pow_all is related to the diagonal entries of the matrices {k }lk=1 . For the
mt = mr = 2 case, pow_all is an l-dimensional vector, whose entries are in
[0, 0.5]. Indeed, the particular formulation of the power constraint in [2, Eq. (41)]
implies that the other entry is uniquely determined from the first one. For the
4 4 case, the code provided assumes that the optimization in [2, Eq. (41)]
is restricted only to {k }lk=1 of the form 1 = = l = . In this case,
pow_all is a 4-dimensional vector that contains the diagonal entries of .
function R=compute_MC_2x2_telatar(snrdB,T,L,epsilon)
Compute the metaconverse upper bound [2, Eq. (41)] by invoking the function
MC USTM 2x2() and by optimizing over the input diagonal matrices {k }lk=1
and the number of effectively used transmit antennas. The optimization over
the {k }lk=1 is restricted to 2 2 diagonal matrices whose diagonal entries are
either [SNR/2, SNR/2] or [SNR, 0] according to the generalized form of Telatar
conjecture reported in [2, Eq. (42)]. NOTE: this function may be very slow if L
is large or epsilon is small.
function [R,current_eps]
=MC_USTM_Alamouti(snrdB,T,L,epsilon,prec,filename)
function [R,current_eps]
=DT_USTM_Alamouti(snrdB,T,L,epsilon,prec,filename)
function [Cout,current_eps]
=outage_alamouti(snrdb,epsilon,L,prec,filename)
function R=outage_2x2_telatar(L,prec,epsilon,snrdb)
The first two functions compute the outage mutual information I for a given
set of diagonal input covariance matrices, and the outage mutual information
with Alamouti, respectively:
P[E[(X l ; Yl )|Hl ] I ] = ,
where in the first case, the covariance structure of X l = (X1 , . . . , Xl ) is specified
by pow_all and
l
l l
X dPYk |Xk
(X ; Y ) = log .
dPYk
k=1
This function computes a lower bound on the ergodic capacity (no CSIR),
obtained by evaluating the mutual information for a USTM input distribution.
It is assumed that mt mr .
Chapter 4
General info:
kXk2F nP.
In the code, we also assume that the entries of H are iid Rician-distributed,
i.e., p
Hij CN ( K/(K + 1), 1/(K + 1))
where K is the Rician K-factor.
The code for the MIMO case (mt > 1) is built under the additional
assumption that all codewords X are isotropic, i.e., (see [3, Sec. III])
1 H P
X X= Im . (4.2)
n mt t
Currently, we do not have code for MIMO achievability and converse
bounds that hold without the assumption (4.2).
Input/output arguments:
15
16 CHAPTER 4. QUASI-STATIC FADING CHANNEL
MetaConverse
EpsilonCapacity
0.8
NormalApproximation
YLabel
0.6 KappaBetaBound
AchNocsi
0.4
0.2
0
0 100 200 300 400 500 600 700 800 900 1000
XLabel
Figure 4.1: Achievability and converse bounds for a quasi-static SIMO Rician-
fading channel with K-factor equal to 20 dB, two receive antennas, SNR = 1.55
dB, and = 103 .
General info:
Maintainer: W. Yang <[email protected]>
Main references: [4]
Channel model:
Yi = HXi + Zi , i = 1, . . . , n (5.1)
where
Xi , Yi C are the channel input and output, respectively
H C is the complex channel coefficient
Zi CN (0, 1) is the i.i.d. white Gaussian noise
An (n, M, )lt code for the channel (5.1) consists of
an encoder f : {1, . . . , M } C Cn that maps the message
W {1, . . . , M } and the channel coefficient H to a codeword xn =
f (W, H) satisfying the long-term (i.e., averaged-over-all-codeword)
power constraint
EW,H kf (W, H)k2 nP
(5.2)
where W is equiprobable on {1, . . . , M }
a decoder g : Cn C {1, . . . , M } satisfying the average error
probability constraint
P[g(Y n , H) 6= W ] (5.3)
where Y n is the channel output induced by the transmitted codeword
xn = f (W, H) according to (5.1).
Remark: for comparison, a code is said to satisfy a short-term (i.e.,
per-codeword) power constraint if the encoder satisfies
kf (W, H)k2 nP (5.4)
with probability one, see Chapter 4.
19
CHAPTER 5. QUASI-STATIC FADING CHANNEL (LONG-TERM
20 POWER CONSTRAINT)
Common input/output arguments:
snr_db input argument; SNR in dB
nn input argument; blocklength
error input argument; block error probability
rate_ach_lt/rate_conv_lt/rate_na_lt output arguments; lower
(achievability) bound, upper (converse) bound, and normal approxi-
mation of (log2 M )/n, maximal achievable rate (in bits/ch. use).
Block-memoryless Rayleigh
Fading (CSIR)
General info:
Maintainer: A. Collins <[email protected]>
Main references: Coming Soon
Example: See Figure 6.1
Channel Model: with nt transmit antennas, nr receive antennas, and
coherence time T , the model is given by
Yj = Hj Xj + Zj , j = 1, . . . , n
Where F is either R or C, and
Xj Fnt T is channel input
Hj Fnr nt is fading matrix, iid Rayleigh per block
Zj Fnr T is the i.i.d. (circularly symmetric) Gassian noise matrix.
Yj Fnr T is output matrix
The input must satisfy the per-codeword power constraint
n
X
kxj k2F nP
j=1
21
22 CHAPTER 6. BLOCK-MEMORYLESS RAYLEIGH FADING (CSIR)
Figure 6.1: Achievability (blue), normal approximation (red), and capacity for
the real MIMO CSIR block fading channel with nt = nr = T = 2, P = 10,
= 103 .
(PY , QY )
log M sup sup
0< < QY 1+ (PXY , PX QY )
Where PY is the output distribution through the channel when the input PX
has the following distribution (X n iid N (0, P/nt ))
nT P
Xn
kX n kF
6.3. NORMAL APPROXIMATION: MIMO CSIR NORMAPX() 23
And QY is the output distribution when the input is iid Gaussian N (0, P/nt ).
Both of these are fairly easily adjustable in the code.
Note that the iter variable in the code sets the number of Monte Carlo
iterations. The sampling loop uses parfor, which attempts to distribute the
computation. The number of Monte Carlo iterations should be taken < 100/.
For small (e.g. 103 , you may want to let the code run overnight.
General info:
Channel model:
Yj = Hj Xj + Zj , j = 1, . . . n= (!!!) (7.1)
Eb
loge 2 1.59 dB
N0
25
CHAPTER 7. ENERGY-PER-BIT UNDER VANISHING SPECTRAL
26 EFFICIENCY
> energy-per-bit/plot_all()
Energy per bit vs. length of the message (Rayleigh fading); =0.001
Energy per bit vs. length of the message (AWGN channel); =0.001
8 10
Achievability noCSI: Achievability (ach_ht)
Normal approximation
Converse
noCSI: Normal approximation
7
Shannon limit, 1.59 dB noCSI: Converse
8 CSIR: Normal approximation
6
Shannon limit, 1.59 dB
5
6
Eb/No, dB
4
Eb/No, dB
4
3
2
2
1
0 0
2 0 1 2 3 4 5
2 0 1 2 3 4 5 6 10 10 10 10 10 10
10 10 10 10 10 10 10
Information bits, k Information bits, k
The converse bound is [6, Theorem 6]. The normal approximation is com-
puted by maximizing over A in [6, (64)].
Note: Vector EE should be in ascending order.
Note: Functions energy_nocsi_ach_ml() and energy_nocsi_conv() are
very slow.
Chapter 8
P[d(S, Z) > d] ,
path(path, ../../lib);
clear all;
N = 10:10:1000;
out = NaN(1, length(N));
for k = 1:length(N)
n = N(k);
try
out(k) = Rstar(..., n, ...);
save(mydatafile);
catch ME
29
CHAPTER 8. FIXED-LENGTH SOURCE CODING UNDER A
30 DISTORTION CRITERION
> cd sc/GMS
> plot_all(0.1, 0.01, 10:5:500)
Lossy compression of iid standard normal source. Distortion=0.1 at excess=1%
3.6
Rogers (achievability)
Normal approximation
3.4 Sphere covering + HT (converse)
3.2
2.8
2.6
2.4
2.2
1.8
1.6
0 50 100 150 200 250 300 350 400 450 500
Blocklength, n
Figure 8.1: Lossy compression bounds for the memoryless Gaussian source.
Source model
S1 , S2 , . . . are i.i.d Bernoulli with bias p.
Distortion measure
Bit error rate
k
1X
d(sk , z k ) = 1{si 6= zi }.
k i=1
Matlab code
sc/BMS/
Main functions
Rstar(d, n, e, p, fun): Compression rate compatible with a given excess
distortion.
Input arguments
d: distortion threshold.
R: compression rate.
n: blocklength.
p: source bias.
Distortion measure
Squared error
k
1X
d(sk , z k ) = (si zi )2
k i=1
Matlab code
sc/GMS/
Main functions
Rstar(d, n, e, fun): Compression rate compatible with a given excess dis-
tortion.
R: compression rate.
n: blocklength.
Source model
S1 , S2 , . . . are i.i.d fair coin flips. However, the encoder does not observe
S1 , S2 , . . .. Instead, it observes an erased version of the source: X1 , X2 , . . .,
where Xi = Si with probability 1 , and Xi = ? with probability .
Distortion measure
Bit error rate with respect to the original source
k
1X
d(sk , z k ) = 1{si 6= zi }, si , zi {0, 1}.
k i=1
Matlab code
sc/BES/
Main functions
Rstar(d, n, e, alpha, fun): Compression rate compatible with a given ex-
cess distortion.
8.3. BINARY ERASED SOURCE 33
Input arguments
d: distortion threshold.
n: blocklength.
e: excess distortion probability.
alpha: erasure probability.
fun: alias for the function to be computed. Acceptable values:
spherecoveringa : Achievability via covering with random spheres [7,
Theorem 33].
spherecoveringc : Converse via sphere covering (hypothesis testing) [7,
Theorem 32].
normal : Gaussian approximation [7, Theorem 12].
aeq : Achievability via covering with random spheres for a surrogate
rate-distortion problem which negates the stochastic variability of
the erasure channel [8].
ceq : Converse via sphere covering (hypothesis testing) for the surrogate
problem [8].
normaleq : Gaussian approximation for the surrogate problem [8].
Chapter 9
Variable-length compression
allowing errors
P[S 6= Z] ,
where S is the source and Z is its reconstruction after the (almost lossless)
encoding.
Performance criterion: average length of the compressed representation.
Performance criterion - excess distortion probability:
P[d(S, Z) > d] ,
path(path, ../../lib);
clear all;
35
CHAPTER 9. VARIABLE-LENGTH COMPRESSION ALLOWING
36 ERRORS
N = 10:10:1000;
out = NaN(1, length(N));
for k = 1:length(N)
n = N(k);
try
out(k) = Rstar(..., n, ...);
save(mydatafile);
catch ME
fprintf(Error: %s\n, getReport(ME));
out(k) = NaN;
end
end
Matlab code
sc/varrate/
Main function
Rstar(p, e, n, fun): Compression rate compatible with a given excess dis-
tortion.
Input arguments
p: source bias.
e: error probability.
n: blocklength.
fun: alias for the function to be computed. Acceptable values:
approx : Gaussian approximation [9, Theorem 4].
exact : Exact minimum average rate [9, (26)].
exacti : Exact value of the Erokhin function [9, (40)].
ie : Exact value of the expectation of the -cutoff of information in
S k [9, (11),(13)].
Chapter 10
P[d(S, Z) > d] ,
path(path, ../../lib);
clear all;
N = 10:10:1000;
out = NaN(1, length(N));
for k = 1:length(N)
n = N(k);
try
out(k) = Rstar(..., n, ...);
save(mydatafile);
37
CHAPTER 10. JOINT SOURCE-CHANNEL CODING UNDER A
38 DISTORTION CRITERION
catch ME
fprintf(Error: %s\n, getReport(ME));
out(k) = NaN;
end
end
Channel model
Yi = Xi + Ni , where Ni are i.i.d. Bernoulli with bias .
Distortion measure
Bit error rate
k
1X
d(sk , z k ) = 1{si 6= zi }.
k i=1
Matlab code
jscc/BMS-BSC/
Main functions
Rstar(p, delta, d, e, n, fun): Compression rate compatible with a given
excess distortion.
Input arguments
p: source bias.
d: distortion threshold.
R: compression rate.
n: blocklength.
random : Achievability via random coding for fair coin flip source [10,
Theorem 6].
nocoding : Achievability via no coding. [10, Theorem 23].
Channel model
Yi = Xi + Ni , where Ni are i.i.d. N (0, 1).
Distortion measure
Squared error
k
k k 1X
d(s , z ) = (si zi )2 .
k i=1
Matlab code
jscc/GMS-AWGN/
Main functions
Rstar(P, d, e, n, fun): Transmission rate compatible with a given excess
distortion (nats).
General info:
Maintainer: Y. Polyanskiy <[email protected]>
Main references: [1]
Example: See Fig. 11.1
Channel model:
Yj = Xj + Zj mod 2, j = 1, . . . , n
41
42 CHAPTER 11. THE BINARY-SYMMETRIC CHANNEL (BSC)
> plot_all()
0.5
0.45
0.4
0.35
0.3
Rate, R
0.25
0.2
0.15
Capacity
0.1
Converse
Normal approximation
0.05 RCU achievability
DT achievability
Gallager achievability
0
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Blocklen, n
General info:
Channel model:
(
Xj , with prob.1
Yj = j = 1, . . . , n
e, with prob.
This function computes and plots various bounds on the same figure. See
Fig. 12.1.
45
46 CHAPTER 12. THE BINARY-ERASURE CHANNEL (BEC)
> plot_all()
0.5
0.45
0.4
0.35
0.3
Rate, R
0.25
0.2
0.15
0.1
Capacity
Converse
0.05 Normal approximation
DT achievability
Gallager achievability
0
0 100 200 300 400 500 600 700 800 900 1000
Blocklen, n
This computes the special converse bound for the BEC, see [1, Theorem
38]. Later, it was found that it corresponds to the meta-converse bound with a
non-product distribution QY n , see [11, Section VI.D].
12.5. NORMAL APPROXIMATION: NORMAPX() 47
General info:
Maintainer: T. Erseghe <[email protected]>
Main references: [12]
Example: See Fig. 13.1
Channel model:
Yj = Xj + Zj , j = 1, . . . , n
49
50 CHAPTER 13. THE BINARY-AWGN CHANNEL (BI-AWGN)
On2 (default) the O(n2 ) approximation derived from [12, Fig. 6, 2nd
block]; at low Pe this is much more reliable than the normal option.
On3 the O(n3 ) approximation derived from [12, Fig. 6, 2nd block];
at high Pe this is much more unrealiable than On2. It can be used to
identify the region where On2 is a reliable solution, namely the region
where On2 and On3 closely match.
full (this option will be available soon) the full bound derived numer-
ically from [12, Fig. 6, 1st block].
Definition #2:
SNRdB = converse_mc(N,Pe,R,approx,error)
for a codeword of length N, and code rate R, the function returns the signal to
noise ration SNRdB (in dB) at which the PPV metaconverse lower bound on
error rate is equal to Pe. Multiple bound values can be obtained by ensuring
that N, Pe, and R have the same length. The specific approximation used for
calculating the bound is specified by approx (see above).
Eb
=
N0
with the SNR, and Eb the energy spent per bit of information. The example
is built on a codeword of length n=1000 for which the bounds at Pe=1e-5 are
derived according to the following code:
n = 1e3;
Pe = 1e-5;
SNRdB = -15:10; % SNR Omega
uno = ones(size(SNRdB)); % vector of ones
figure
set(0,defaulttextinterpreter,latex)
semilogy(EbN0PPV,rhoPPV,-,EbN0PPVb,rhoPPVb,--,...
EbN0NA,rhoNA,-.)
xlabel(SNR $E_b/N_0$)
ylabel(spectral efficiency $\rho$ [bit/s/Hz])
grid
n = 1000, Pe = 1e - 05 n = 1000, R = 0. 5
1 0
10 10
1
10
sp e c t r al e ffi c i e n c y [ b i t /s/H z ]
0
10
2
10
O ( n 2 ) ap p r ox
e r r or p r ob ab i l i ty P e
O ( n 3 ) ap p r ox
3
10
n or m al ap p r ox
1
10
4
10
5
10
2
10
6
10
3 7
10 10
0 5 10 15 0.5 0 0.5 1 1.5 2
S N R E b /N 0 S N R E b /N 0
n = 1e3;
R = 1/2;
Pev = 10.^([-0.5:-0.25:-1.75,-2:-0.5:-7]);
uno = ones(size(Pev));
figure
set(0,defaulttextinterpreter,latex)
semilogy(SNRdBPPV,Pev,-,SNRdBPPVb,Pev,--,...
SNRdBNA,Pev,-.)
xlabel(SNR $E_b/N_0$)
ylabel(error probability $P_e$)
grid
The result is given in the plot on the right in Fig. 13.1
Bibliography
53