summaryrefslogtreecommitdiff
path: root/Electronic_Communication_by_D._Roddy/Chapter12_Digital_Communications.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Electronic_Communication_by_D._Roddy/Chapter12_Digital_Communications.ipynb')
-rw-r--r--Electronic_Communication_by_D._Roddy/Chapter12_Digital_Communications.ipynb334
1 files changed, 334 insertions, 0 deletions
diff --git a/Electronic_Communication_by_D._Roddy/Chapter12_Digital_Communications.ipynb b/Electronic_Communication_by_D._Roddy/Chapter12_Digital_Communications.ipynb
new file mode 100644
index 00000000..6ee4bd31
--- /dev/null
+++ b/Electronic_Communication_by_D._Roddy/Chapter12_Digital_Communications.ipynb
@@ -0,0 +1,334 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter12 Digital Communications"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.4.1,Pg.no.419"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 47,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a= 1.0\n",
+ "b= 6.33 *10**-5\n",
+ "The bit error probability 3.17 *10**-5\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "from math import sqrt,erf,erfc\n",
+ "Vs_Vn=4 #SNVR \n",
+ "a=erf(4/sqrt(2))\n",
+ "b=erfc(4/sqrt(2))*10**5\n",
+ "Pbe=(0.5)*(b) #bit error probability\n",
+ "a=round(a,2)\n",
+ "b=round(b,2)\n",
+ "print 'a=',a\n",
+ "print 'b=',b,'*10**-5'\n",
+ "Pbe=round(Pbe,2)\n",
+ "print 'The bit error probability',Pbe,'*10**-5'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.4.2,Pg.no.420"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 43,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The bit error probability 0.309\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "A=4 #max value of received signal voltage\n",
+ "Vn=0.5 #rms noise voltage\n",
+ "Vth=2 #Threshold voltage for the comparator\n",
+ "b=erfc(Vn/sqrt(2))\n",
+ "Pbe=(0.5) * b #bit error probability\n",
+ "Pbe=round(Pbe,3)\n",
+ "print 'The bit error probability',Pbe "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.4.3,Pg.no.421"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 41,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Bit Probabilty,Pbe1= 0.0024\n",
+ "Bit Probability,Pbe2= 0.0232\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "from math import erfc\n",
+ "SNR=9.0 #SNR in dB\n",
+ "#conversion of dB to power ratio\n",
+ "p=10**(9/10) #for Polar\n",
+ "Pbe1=0.5*erfc(sqrt(7.94/2))\n",
+ "Pbe1=round(Pbe1,4)\n",
+ "print 'Bit Probabilty,Pbe1=',Pbe1\n",
+ "#for Unipolar\n",
+ "Pbe2=0.5* erfc(sqrt(7.94)/2)\n",
+ "Pbe2=round(Pbe2,4)\n",
+ "print 'Bit Probability,Pbe2=',Pbe2"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.5.1,Pg.no.423"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 37,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The bit error probability 3.5 *10**-5\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "Pavg=6.0*10**-12 #in W\n",
+ "d=0.02*10**-6 #pulse duration in sec\n",
+ "T=550.0 #equivalent noise temp in K\n",
+ "Eb=Pavg*d #avg energy per pulse\n",
+ "No=1.38*10**-23*T\n",
+ "r=Eb/No #Bit error probability is\n",
+ "Pbe=0.5*erfc(sqrt(r/2))*10**5\n",
+ "Pbe=round(Pbe,1)\n",
+ "print 'The bit error probability',Pbe,'*10**-5' "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.9.1,Pg.no.435"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a)The bit error probability 0.00078\n",
+ "b)The bit error probability 0.00337\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "from math import exp\n",
+ "ENR=10.0 #energy to noise density ratio\n",
+ "Pbe1=0.5* erfc(sqrt(ENR/2))\n",
+ "Pbe1=round(Pbe1,5)\n",
+ "print 'a)The bit error probability',Pbe1\n",
+ "Pbe2=(0.5)*exp(-(ENR/2))\n",
+ "Pbe2=round(Pbe2,5)\n",
+ "print 'b)The bit error probability',Pbe2"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.13.1,Pg.no.451"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The probability of a received codeword 5.33 *10**5\n",
+ "P_in= 5.6 *10**5\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "Pbec=0.01\n",
+ "n=8.0\n",
+ "i=3.0\n",
+ "Pi=(Pbec**i)*((1-(Pbec))**(n-i))\n",
+ "Cin=(math.factorial(n))/(math.factorial(i)*math.factorial(n-i))\n",
+ "Pin=Cin*Pi*10**5\n",
+ "P_in=Cin*Pbec**i*10**5\n",
+ "Pin=round(Pin,2)\n",
+ "P_in=round(P_in,2)\n",
+ "print 'The probability of a received codeword',Pin,'*10**5'\n",
+ "print 'P_in=',P_in,'*10**5'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.13.3,Pg.no.454"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a)The bit error probability 0.079\n",
+ "b)The bit error probability 2.25\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "from math import sqrt,erf\n",
+ "SN_dB=9\n",
+ "SNR=10**(SN_dB/10)\n",
+ "PbeU=0.5 * (1-erf(sqrt(SNR)))\n",
+ "BERu=PbeU\n",
+ "BERu=round(BERu,3)\n",
+ "print 'a)The bit error probability',BERu\n",
+ "n=10\n",
+ "k=n-1\n",
+ "r=k/n\n",
+ "SNR1=r*SNR\n",
+ "PbeC=0.5 *(1-erf(sqrt(SNR1)))\n",
+ "BERc=(n-1)*PbeC**2\n",
+ "print 'b)The bit error probability',BERc"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 12.13.4,Pg.no.457"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "a)The bit−error rate is 0.079\n",
+ "b)The new bit error rate is 3.5\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "from math import sqrt\n",
+ "SN_dB=8\n",
+ "SNR=10**(SN_dB/10) #a) Determination of bit error rate\n",
+ "PbeU=0.5*(1-erf(sqrt(SNR)))\n",
+ "BER_U=PbeU\n",
+ "BER_U=round(BER_U,3)\n",
+ "print 'a)The bit−error rate is',BER_U\n",
+ "#b)new bit error rate\n",
+ "n=15\n",
+ "k=11\n",
+ "t=1\n",
+ "r=k/n\n",
+ "SNR_n=r*SNR\n",
+ "PbeC=0.5*(1-erf(sqrt(SNR_n)))\n",
+ "BER_C=((math.factorial(n-1))*PbeC**(t+1))/((math.factorial(t)) *(math.factorial(n-t-1)))\n",
+ "print 'b)The new bit error rate is',BER_C "
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.10"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}