/usr/share/doc/libitpp-dev/html/bpsk.html is in libitpp-doc 4.3.1-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Welcome to IT++!</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div style="width: 100%; height: 40px; background-color: #ffff00; border: 1px solid #b0b0b0; margin: 5px 5px 5px 0; padding: 2px;">
<a href="http://itpp.sourceforge.net"><img src="itpp_logo.png" alt="IT++ Logo" style="float: left; border: 0;"></a>
</div>
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,true,'search.php','Search');
$(document).ready(function() {
if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }
});
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">BPSK modulation over an AWGN channel </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>As a first example we will generate a sequence of 500000 random bits {0,1} and BPSK modulate these. Thereafter the BPSK signals will be transmitted over an AWGN channel with a signal-to-noise ratio <img class="formulaInl" alt="$E_b/N_0 = 0$" src="form_304.png"/> dB. The received signal is then decoded and the number of bit errors are calculated.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="itcomm_8h.html">itpp/itcomm.h</a>></span></div><div class="line"></div><div class="line"><span class="keyword">using namespace </span><a class="code" href="namespaceitpp.html">itpp</a>;</div><div class="line"></div><div class="line"><span class="comment">//These lines are needed for use of cout and endl</span></div><div class="line"><span class="keyword">using</span> std::cout;</div><div class="line"><span class="keyword">using</span> std::endl;</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line"> <span class="comment">//Scalars</span></div><div class="line"> <span class="keywordtype">int</span> N;</div><div class="line"> <span class="keywordtype">double</span> N0;</div><div class="line"></div><div class="line"> <span class="comment">//Vectors</span></div><div class="line"> bvec bits, dec_bits;</div><div class="line"> vec symbols, rec;</div><div class="line"></div><div class="line"> <span class="comment">//Classes</span></div><div class="line"> <a class="code" href="classitpp_1_1BPSK.html">BPSK</a> bpsk; <span class="comment">//The BPSK modulator/debodulator class</span></div><div class="line"> <a class="code" href="classitpp_1_1BERC.html">BERC</a> berc; <span class="comment">//The Bit Error Rate Counter class</span></div><div class="line"></div><div class="line"> <span class="comment">//Init</span></div><div class="line"> N = 500000; <span class="comment">//The number of bits to simulate</span></div><div class="line"> N0 = 1; <span class="comment">//0 dB SNR</span></div><div class="line"></div><div class="line"> <span class="comment">//Randomize the random number generator</span></div><div class="line"> <a class="code" href="group__randgen.html#ga001a62b1a1e3092d3bc60f71c95208cd">RNG_randomize</a>();</div><div class="line"></div><div class="line"> <span class="comment">//Generate the bits:</span></div><div class="line"> bits = <a class="code" href="group__randgen.html#ga5aa06887cf1fd3301b040987924068f0">randb</a>(N);</div><div class="line"></div><div class="line"> <span class="comment">//Do the BPSK modulation</span></div><div class="line"> bpsk.<a class="code" href="classitpp_1_1BPSK.html#a06cade730cc0156fca656082ac393277">modulate_bits</a>(bits, symbols);</div><div class="line"></div><div class="line"> <span class="comment">//Add the AWGN</span></div><div class="line"> rec = symbols + <a class="code" href="group__miscfunc.html#gaf559d29ca56ad3396a4284964b01a9b0">sqrt</a>(N0 / 2) * <a class="code" href="group__randgen.html#ga9ecf5af23567f51abc9af737fdbd872a">randn</a>(N);</div><div class="line"></div><div class="line"> <span class="comment">//Decode the received bits</span></div><div class="line"> bpsk.<a class="code" href="classitpp_1_1BPSK.html#a6a18384c68a902097511e336059e8099">demodulate_bits</a>(rec, dec_bits);</div><div class="line"></div><div class="line"> <span class="comment">//Count the number of errors</span></div><div class="line"> berc.<a class="code" href="classitpp_1_1BERC.html#a539b0c989badff3027d97e4693fc9cd7">count</a>(bits, dec_bits);</div><div class="line"></div><div class="line"> <span class="comment">//Print the results</span></div><div class="line"> cout << <span class="stringliteral">"There were "</span> << berc.<a class="code" href="classitpp_1_1BERC.html#a3ff000a38f8ab0e9a6a34329b51ca5ca">get_errors</a>() << <span class="stringliteral">" received bits in error."</span> << endl;</div><div class="line"> cout << <span class="stringliteral">"There were "</span> << berc.<a class="code" href="classitpp_1_1BERC.html#a00504734327637cc923d5326a8ace54f">get_corrects</a>() << <span class="stringliteral">" correctly received bits."</span> << endl;</div><div class="line"> cout << <span class="stringliteral">"The error probability was "</span> << berc.<a class="code" href="classitpp_1_1BERC.html#a4c66254b338ac55bfce1008fff5ce6db">get_errorrate</a>() << endl;</div><div class="line"> cout << <span class="stringliteral">"The theoretical error probability is "</span> << 0.5*<a class="code" href="group__errorfunc.html#gaddd7604b61e53771a01d0a784e7c7a8a">erfc</a>(1.0) << endl;</div><div class="line"></div><div class="line"> <span class="comment">//Exit program:</span></div><div class="line"> <span class="keywordflow">return</span> 0;</div><div class="line"></div><div class="line">}</div></div><!-- fragment --><p>When you run this program, the output will look something like this:</p>
<div class="fragment"><div class="line">There were 39224 received bits in error.</div><div class="line">There were 460776 correctly received bits.</div><div class="line">The error probability was 0.078448</div><div class="line">The theoretical error probability is 0.0786496</div></div><!-- fragment --> </div></div><!-- contents -->
<div style="clear: both; width: 100%; height: 31px; background-color: #ffff00; border: 1px solid #b0b0b0; margin: 5px 5px 5px 0; padding: 2px;">
<p style="padding-left: 10px; font-size: 85%;">Generated on Sat Sep 30 2017 07:04:09 for IT++ by <a href="http://www.doxygen.org/index.html">Doxygen</a> 1.8.13</p>
</div>
</body>
</html>
|