successive interference cancellation matlab code
Introduction
Single user detectors are not optimal for CDMA because they process other user interference as unstructured channel noise. Better CDMA receivers can be designed if the specific structure of multiple access interference (MAI) is fully exploited. To realize this, novel receiver structures have been proposed over the years that take advantage of the knowledge of MA1 signal parameters [144-1481. Such receivers termed as multi-user receivers are more complex than conventional ones because of their capability of using MA1 signal information to help recover the
desired user. A general multi-user detector depicted in Figure 2.1, is composed of an initial correlation stage followed by a set of additional stages where a multi-user detection algorithm is implemented. It is shown by Verdu that the set of correlator outputs for each user forms a set of sufficient statistics which, if processed properly, can lead to an optimal multi-user detection. The most commonly analyzed multi-user
detectors are presented in this section.
This example shows spatial multiplexing schemes wherein the data stream is subdivided into independent sub-streams, one for each transmit antenna employed. As a consequence, these schemes provide a multiplexing gain and do not require explicit orthogonalization as needed for space-time block coding.
Spatial multiplexing requires powerful decoding techniques at the receiver though. Of the many proposed [ 1 ], this example highlights two ordered Successive Interference Cancellation (SIC) detection schemes. These schemes are similar to the original Bell Labs Layered Space-Time (BLAST) techniques as per [ 2 ], [ 3 ].
For expositional benefits the example uses the basic 2x2 MIMO system employing two transmit and two receive antennas. For an uncoded QPSK modulated system it employs flat Rayleigh fading over independent transmit-receive links. At the receiver end, we assume perfect channel knowledge with no feedback to the transmitter, i.e., an open-loop spatial multiplexing system.
The example shows two nonlinear interference cancellation methods - Zero-Forcing (ZF) and Minimum-Mean-Square-Error (MMSE) - with symbol cancellation and compares their performance with the Maximum-Likelihood (ML) optimum receiver.
Simulation
Selected References
Simulation
We start by defining some common simulation parameters
N = 2; % Number of transmit antennas
M = 2; % Number of receive antennas
EbNoVec = 2:3:8; % Eb/No in dB
modOrd = 2; % constellation size = 2^modOrd
and set up the simulation.
% Create a local random stream to be used by random number generators for
% repeatability.
hStr = RandStream('mt19937ar');
% Create PSK modulator and demodulator System objects
hMod = comm.PSKModulator(...
'ModulationOrder', 2^modOrd, ...
'PhaseOffset', 0, ...
'BitInput', true);
hDemod = comm.PSKDemodulator( ...
'ModulationOrder', 2^modOrd, ...
'PhaseOffset', 0, ...
'BitOutput', true);
% Create error rate calculation System objects for 3 different receivers
hZFBERCalc = comm.ErrorRate;
hMMSEBERCalc = comm.ErrorRate;
hMLBERCalc = comm.ErrorRate;
% Get all bit and symbol combinations for ML receiver
allBits = de2bi(0:2^(modOrd*N)-1, 'left-msb')';
allTxSig = reshape(step(hMod, allBits(
), N, 2^(modOrd*N));
% Pre-allocate variables to store BER results for speed
[BER_ZF, BER_MMSE, BER_ML] = deal(zeros(length(EbNoVec), 3));
The simulation loop below simultaneously evaluates the BER performance of the three receiver schemes for each Eb/No value using the same data and channel realization. A short range of Eb/No values are used for simulation purposes. Results for a larger range, using the same code, are presented later.
% Set up a figure for visualizing BER results
h = gcf;
grid on;
hold on;
ax = gca;
ax.YScale = 'log'
xlim([EbNoVec(1)-0.01 EbNoVec(end)]);
ylim([1e-3 1]);
xlabel('Eb/No (dB)');
ylabel('BER');
h.NumberTitle = 'off';
h.Renderer = 'zbuffer';
h.Name = 'Spatial Multiplexing';
title('2x2 Uncoded QPSK System');
% Loop over selected EbNo points
for idx = 1:length(EbNoVec)
% Reset error rate calculation System objects
reset(hZFBERCalc);
reset(hMMSEBERCalc);
reset(hMLBERCalc);
% Calculate SNR from EbNo for each independent transmission link
snrIndB = EbNoVec(idx) + 10*log10(modOrd);
snrLinear = 10^(0.1*snrIndB);
while (BER_ZF(idx, 3) < 1e5) && ((BER_MMSE(idx, 2) < 100) || ...
(BER_ZF(idx, 2) < 100) || (BER_ML(idx, 2) < 100))
% Create random bit vector to modulate
msg = randi(hStr, [0 1], [N*modOrd, 1]);
% Modulate data
txSig = step(hMod, msg);
% Flat Rayleigh fading channel with independent links
rayleighChan = (randn(hStr, M, N) + 1i*randn(hStr, M, N))/sqrt(2);
% Add noise to faded data
rxSig = awgn(rayleighChan*txSig, snrIndB, 0, hStr);
% ZF-SIC receiver
r = rxSig;
H = rayleighChan; % Assume perfect channel estimation
% Initialization
estZF = zeros(N*modOrd, 1);
orderVec = 1:N;
k = N+1;
% Start ZF nulling loop
for n = 1:N
% Shrink H to remove the effect of the last decoded symbol
H = H(:, [1:k-1,k+1:end]);
% Shrink order vector correspondingly
orderVec = orderVec(1, [1:k-1,k+1:end]);
% Select the next symbol to be decoded
G = (H'*H) \ eye(N-n+1); % Same as inv(H'*H), but faster
[~, k] = min(diag(G));
symNum = orderVec(k);
% Hard decode the selected symbol
decBits = step(hDemod, G(k,
* H' * r);
estZF(modOrd * (symNum-1) + (1:modOrd)) = decBits;
% Subtract the effect of the last decoded symbol from r
if n < N
r = r - H(:, k) * step(hMod, decBits);
end
end
% MMSE-SIC receiver
r = rxSig;
H = rayleighChan;
% Initialization
estMMSE = zeros(N*modOrd, 1);
orderVec = 1:N;
k = N+1;
% Start MMSE nulling loop
for n = 1:N
H = H(:, [1:k-1,k+1:end]);
orderVec = orderVec(1, [1:k-1,k+1:end]);
% Order algorithm (matrix G calculation) is the only difference
% with the ZF-SIC receiver
G = (H'*H + ((N-n+1)/snrLinear)*eye(N-n+1)) \ eye(N-n+1);
[~, k] = min(diag(G));
symNum = orderVec(k);
decBits = step(hDemod, G(k,
* H' * r);
estMMSE(modOrd * (symNum-1) + (1:modOrd)) = decBits;
if n < N
r = r - H(:, k) * step(hMod, decBits);
end
end
% ML receiver
r = rxSig;
H = rayleighChan;
[~, k] = min(sum(abs(repmat(r,[1,2^(modOrd*N)]) - H*allTxSig).^2));
estML = allBits(:,k);
% Update BER
BER_ZF( idx,
= step(hZFBERCalc, msg, estZF);
BER_MMSE(idx,
= step(hMMSEBERCalc, msg, estMMSE);
BER_ML( idx,
= step(hMLBERCalc, msg, estML);
end
% Plot results
semilogy(EbNoVec(1:idx), BER_ZF( 1:idx, 1), 'r*', ...
EbNoVec(1:idx), BER_MMSE(1:idx, 1), 'bo', ...
EbNoVec(1:idx), BER_ML( 1:idx, 1), 'gs');
legend('ZF-SIC', 'MMSE-SIC', 'ML');
drawnow;
end
% Draw the lines
semilogy(EbNoVec, BER_ZF( :, 1), 'r-', ...
EbNoVec, BER_MMSE(:, 1), 'b-', ...
EbNoVec, BER_ML( :, 1), 'g-');
hold off;