Go to the documentation of this file.00001 #include <itpp/itcomm.h>
00002
00003 using namespace itpp;
00004
00005
00006 using std::cout;
00007 using std::endl;
00008
00009 int main()
00010 {
00011
00012 int N;
00013 double N0;
00014
00015
00016 bvec bits, dec_bits;
00017 vec symbols, rec;
00018
00019
00020 BPSK bpsk;
00021 BERC berc;
00022
00023
00024 N = 500000;
00025 N0 = 1;
00026
00027
00028 RNG_randomize();
00029
00030
00031 bits = randb(N);
00032
00033
00034 bpsk.modulate_bits(bits, symbols);
00035
00036
00037 rec = symbols + sqrt(N0/2)* randn(N);
00038
00039
00040 bpsk.demodulate_bits(rec, dec_bits);
00041
00042
00043 berc.count(bits,dec_bits);
00044
00045
00046 cout << "There were " << berc.get_errors() << " received bits in error." << endl;
00047 cout << "There were " << berc.get_corrects() << " correctly received bits." << endl;
00048 cout << "The error probability was " << berc.get_errorrate() << endl;
00049 cout << "The theoretical error probability is " << 0.5*erfc(1.0) << endl;
00050
00051
00052 return 0;
00053
00054 }