The turbo equalizer uses a SISO NSC module and a SISO equalizer module. Optionally a precoder can be used at the channel input (by default the precoder is enabled).
Reference: R. Koetter, A. C. Singer, and M. Tuchler, ''Turbo equalization: an iterative equalization and decoding technique for coded data transmision,`` IEEE Signal Processing Magazine, pp. 67-80, Jan. 2004
#define USE_PRECODER
using namespace itpp;
using std::cout;
using std::endl;
using std::string;
int main(void)
{
double threshold_value = 50;
string map_metric = "maxlogMAP";
ivec gen = "07 05";
int constraint_length = 3;
int ch_nb_taps = 4;
int nb_errors_lim = 3000;
int nb_bits_lim = int(1e6);
int perm_len =
pow2i(14);
int nb_iter = 10;
vec EbN0_dB = "0:0.5:10";
double R = 1.0 / 2.0;
double Ec = 1.0;
#ifdef USE_PRECODER
ivec prec_gen = "03 02";
int prec_gen_length = 2;
#endif
int nb_bits_tail = perm_len / gen.length();
int nb_bits = nb_bits_tail - (constraint_length - 1);
vec sigma2 = (0.5 * Ec / R) *
pow(
inv_dB(EbN0_dB), -1.0);
int nb_blocks;
int nb_errors;
bvec bits(nb_bits);
bvec nsc_coded_bits(perm_len);
bvec em_bits(perm_len);
ivec perm(perm_len);
ivec inv_perm(perm_len);
vec rec(perm_len);
vec eq_apriori_data(perm_len);
vec eq_extrinsic_data;
vec nsc_intrinsic_coded(perm_len);
vec nsc_apriori_data(nb_bits_tail);
nsc_apriori_data.zeros();
vec nsc_extrinsic_coded;
vec nsc_extrinsic_data;
bvec rec_bits(nb_bits_tail);
int snr_len = EbN0_dB.length();
mat ber(nb_iter, snr_len);
ber.zeros();
register int en, n;
#ifdef USE_PRECODER
#endif
vec ch_imp_response(ch_nb_taps);
vec ini_state =
ones(ch_nb_taps);
#ifdef USE_PRECODER
#endif
for (en = 0;en < snr_len;en++) {
cout << "EbN0_dB = " << EbN0_dB(en) << endl;
nb_errors = 0;
nb_blocks = 0;
while ((nb_errors < nb_errors_lim) && (nb_blocks*nb_bits < nb_bits_lim))
{
perm = sort_index(
randu(perm_len));
inv_perm = sort_index(perm);
em_bits = nsc_coded_bits(perm);
#ifdef USE_PRECODER
prec.
encode(em_bits, parity_bits);
em_bits = parity_bits.get_col(0);
#endif
ch_imp_response =
randray(ch_nb_taps);
eq_apriori_data.zeros();
for (n = 0;n < nb_iter;n++)
{
siso.
equalizer(eq_extrinsic_data, rec, eq_apriori_data,
false);
nsc_intrinsic_coded =
SISO::threshold(eq_extrinsic_data(inv_perm), threshold_value);
siso.
nsc(nsc_extrinsic_coded, nsc_extrinsic_data, nsc_intrinsic_coded, nsc_apriori_data,
true);
berc.
count(bits, rec_bits.left(nb_bits));
eq_apriori_data = nsc_extrinsic_coded(perm);
}
nb_blocks++;
}
ber.set_col(en, ber.get_col(en) / nb_blocks);
}
it_file ff(
"turbo_equalizer_bersim_multipath.it");
ff <<
Name(
"BER") << ber;
ff <<
Name(
"EbN0_dB") << EbN0_dB;
return 0;
}
When you run this program, the results (BER and EbN0_dB) are saved into turbo_equalizer_bersim_multipath.it file. Using the following MATLAB script
itload('turbo_equalizer_bersim_multipath.it');
figure
semilogy(EbN0_dB, BER, 'o-')
grid on
ylabel('BER')
the results can be displayed.