summaryrefslogtreecommitdiff
path: root/Analog_and_digital_communication_by_S_Sharma
diff options
context:
space:
mode:
Diffstat (limited to 'Analog_and_digital_communication_by_S_Sharma')
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/Chapter10.ipynb250
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/Chapter11.ipynb1653
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/Chapter2.ipynb948
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/Chapter3.ipynb168
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/Chapter4.ipynb367
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/Chapter5.ipynb2125
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/Chapter6.ipynb785
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/Chapter7.ipynb224
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/Chapter8.ipynb737
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/README.txt10
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/screenshots/chap11.pngbin0 -> 60358 bytes
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/screenshots/chap2.pngbin0 -> 50039 bytes
-rwxr-xr-xAnalog_and_digital_communication_by_S_Sharma/screenshots/chap3.pngbin0 -> 82119 bytes
13 files changed, 7267 insertions, 0 deletions
diff --git a/Analog_and_digital_communication_by_S_Sharma/Chapter10.ipynb b/Analog_and_digital_communication_by_S_Sharma/Chapter10.ipynb
new file mode 100755
index 00000000..abcc70cf
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/Chapter10.ipynb
@@ -0,0 +1,250 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:67ee8e7b784b607cbab75ad3758612a5810d648f2de452b74761d1700d1555d3"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 10 - Digital Multiplexers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - pg 469"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the minimum value of permissible sampling rate\n",
+ "\n",
+ "#given\n",
+ "X_1 = 4.*10**3#first analog signal in Hz\n",
+ "X_2 = 4.5*10**3#second analog signal in Hz\n",
+ "\n",
+ "#calculation\n",
+ "#the highest frequency cmponent of the composite signal consisting among two signal is X_2\n",
+ "f_sMIN = 2*X_2;\n",
+ "\n",
+ "print \"The minimum value of permissible sampling rate (kHz) = \",f_sMIN/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The minimum value of permissible sampling rate (kHz) = 9.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - pg 469"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the signalling rate and minimum channel bandwidth\n",
+ "\n",
+ "#given\n",
+ "X_1 = 6.*10**3#Nyquist rate in Hz obtained the table\n",
+ "X_2 = 2.*10**3#Nyquist rate in Hz obtained the table\n",
+ "X_3 = 2.*10**3#Nyquist rate in Hz obtained the table\n",
+ "X_4 = 2.*10**3#Nyquist rate in Hz obtained the table\n",
+ "\n",
+ "#calculations\n",
+ "s = 2000#speed of rotation\n",
+ "X1 = 3*s#number of samples produced per second for first signal\n",
+ "X2 = 1*s#number of samples produced per second for second signal\n",
+ "X3 = X2#number of samples produced per second for third signal\n",
+ "X3 = X2#number of samples produced per second for fourth signal\n",
+ "SR = X1 + 3*X2#signalling rate\n",
+ "BW = .5*SR#minimum channel bandwidth \n",
+ "\n",
+ "#results\n",
+ "print \"If the sampling commutator rotates at the rate of 2000 rotations per second the the signals X_1,X_2,X_3,X_4 will be sampled at their Nyquist rate\"\n",
+ "print \"Signalling rate (samples per second) = \",SR\n",
+ "print \"Minimum channel bandwidth (Hz) = \",BW\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "If the sampling commutator rotates at the rate of 2000 rotations per second the the signals X_1,X_2,X_3,X_4 will be sampled at their Nyquist rate\n",
+ "Signalling rate (samples per second) = 12000\n",
+ "Minimum channel bandwidth (Hz) = 6000.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - pg 470"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the sampling rate and Nyquist rate\n",
+ "\n",
+ "#given\n",
+ "SR = 8000.#sampling rate in samples per second\n",
+ "T = 1.*10**-6#pulse duration\n",
+ "f = 3.4*10**3#highest frequency component\n",
+ "\n",
+ "#calculations\n",
+ "#second case\n",
+ "NR = 2.*f#Nyquist rate of sampling\n",
+ "T2 = 1./NR#time taken for one rotation of commutator\n",
+ "\n",
+ "\n",
+ "#results\n",
+ "print \"sampling rate for first condition = \",SR\n",
+ "print \"There are 24 voice signals + 1 synchronizing pulse\"\n",
+ "print \"Pulse width of each voice channel and synchronizing pulseis 1 microseconds \"\n",
+ "print \"Now, time taken by the commutator for 1 rotation =1/8000 = 125*10**-6 seconds\"\n",
+ "print \"Number of pulses produced in one rotation = 24 + 1 = 25\"\n",
+ "print \"Therefore, the leading edges of the pulses are at 125/25 = 5*10^-6 seconds distance\"\n",
+ "print \"Nyquist rate for second condition (kHz) = \",NR/1000.\n",
+ "print \"Time taken for one rotation of commutator (museconds) = \",round(T2*10**6,2)\n",
+ "print \"Therefore, 147*10**-6 seconds corresponds to 25 pulses\"\n",
+ "print \"therefore, 1 pulse corresponds to 5.88*10^-6 seconds\"\n",
+ "print \"As the pulse width of each pulse is 1*10^-6 seconds, the spacing between adjacent pulses will be 4.88*10**-6 seconds\\n and if we assume tou = 0 then the spacing between the adjacent pulses will be 5.88*10**-6 seconds \"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "sampling rate for first condition = 8000.0\n",
+ "There are 24 voice signals + 1 synchronizing pulse\n",
+ "Pulse width of each voice channel and synchronizing pulseis 1 microseconds \n",
+ "Now, time taken by the commutator for 1 rotation =1/8000 = 125*10**-6 seconds\n",
+ "Number of pulses produced in one rotation = 24 + 1 = 25\n",
+ "Therefore, the leading edges of the pulses are at 125/25 = 5*10^-6 seconds distance\n",
+ "Nyquist rate for second condition (kHz) = 6.8\n",
+ "Time taken for one rotation of commutator (museconds) = 147.06\n",
+ "Therefore, 147*10**-6 seconds corresponds to 25 pulses\n",
+ "therefore, 1 pulse corresponds to 5.88*10^-6 seconds\n",
+ "As the pulse width of each pulse is 1*10^-6 seconds, the spacing between adjacent pulses will be 4.88*10**-6 seconds\n",
+ " and if we assume tou = 0 then the spacing between the adjacent pulses will be 5.88*10**-6 seconds \n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4 - pg 471"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Signaling rate and minimum channel bandwidth\n",
+ "\n",
+ "#given\n",
+ "N = 6.#number of channels\n",
+ "f_m = 5.*10**3#bandwidth of each channel\n",
+ "\n",
+ "#calculations\n",
+ "SR1= 2*f_m#minimum sampling rate\n",
+ "SR = N*SR1#sampling rate\n",
+ "BW =N*f_m#minimum channel bandwidth\n",
+ "\n",
+ "#results\n",
+ "print \"Signaling rate (Kbits per second) = \",SR/1000.\n",
+ "print \"Minimum channel bandwidth (kHz) = \",BW/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Signaling rate (Kbits per second) = 60.0\n",
+ "Minimum channel bandwidth (kHz) = 30.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6 - pg 476"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the number of framing plus signaling bits per frame\n",
+ "\n",
+ "#given\n",
+ "channel=64*10**3 #kb/s\n",
+ "bitrate=2.048*10**6 #bits/sec\n",
+ "\n",
+ "#calculations\n",
+ "fs_min=channel*2\n",
+ "x=bitrate/fs_min\n",
+ "\n",
+ "#results\n",
+ "print 'No. of bits per frame = ',x"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "No. of bits per frame = 16.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Analog_and_digital_communication_by_S_Sharma/Chapter11.ipynb b/Analog_and_digital_communication_by_S_Sharma/Chapter11.ipynb
new file mode 100755
index 00000000..642532b4
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/Chapter11.ipynb
@@ -0,0 +1,1653 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:d35f66e241c83fce49bf0f825461c9bef7321fa8529d41a1200b86c1371dbb65"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 11 - Information theory"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - pg 488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the information content in all symbols\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "Px_1=1./2;#probability 1\n",
+ "Px_2=1./4;#probability 2\n",
+ "Px_3=1./8;#probability 3\n",
+ "Px_4=1./8;#probability 4\n",
+ "\n",
+ "#calculations\n",
+ "Ix_1 = log2(1/(Px_1))#information content in first probability\n",
+ "Ix_2 = log2(1/(Px_2))#information content in first probability\n",
+ "Ix_3 = log2(1/(Px_3))#information content in first probability\n",
+ "Ix_4 = log2(1/(Px_3))#information content in first probability\n",
+ "\n",
+ "#results\n",
+ "print \"i. Information content of first symbol (bits) = \",Ix_1\n",
+ "print \"ii. Information content of second symbol (bits) = \",Ix_2\n",
+ "print \"iii. Information content of third symbol (bits) = \",Ix_3\n",
+ "print \"iV. Information content of fourth symbol (bits)\",Ix_4\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i. Information content of first symbol (bits) = 1.0\n",
+ "ii. Information content of second symbol (bits) = 2.0\n",
+ "iii. Information content of third symbol (bits) = 3.0\n",
+ "iV. Information content of fourth symbol (bits) 3.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - pg 488"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the amount of information\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "Px_i = 1./4#probability of a symbol\n",
+ "\n",
+ "#calculation\n",
+ "Ix_i = (log(1/Px_i))/log(2)#formula for amount of information of a symbol\n",
+ "\n",
+ "#result\n",
+ "print \"i. Amount of information (bits) = \",Ix_i\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i. Amount of information (bits) = 2.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the amount of information\n",
+ "#given\n",
+ "import math\n",
+ "from math import log\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "#since there are only two binary levels i.e. 1 or 0. Since, these two binary levels occur with equal likelihood of occurrence will be\n",
+ "Px_1 = 1./2#probability of zero level\n",
+ "Px_2 = 1./2#probability of first level\n",
+ "\n",
+ "#calculations\n",
+ "Ix_1 = log2(1/Px_1)#amount of information of zero level with base 2\n",
+ "Ix_2 = log2(1/Px_2)#amount of information of first level with base 2\n",
+ "Ix_1= log(1/Px_1)/log(2)#amount of information content with base 10\n",
+ "Ix_2 = Ix_1 \n",
+ "\n",
+ "#result\n",
+ "print \"i.Amount of information content wrt binary PCM 0 (bit) = \",Ix_1\n",
+ "print \"ii.Amount of information content wrt binary PCM 1 (bit) = \",Ix_2\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Amount of information content wrt binary PCM 0 (bit) = 1.0\n",
+ "ii.Amount of information content wrt binary PCM 1 (bit) = 1.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4 - pg 489"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the amount of information\n",
+ "import math\n",
+ "from math import log\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "#given\n",
+ "Px_1 = 1./4#probability wrt to binary PCM '0'\n",
+ "Px_2 = 3./4#probability wrt to binary PCM '1'\n",
+ "\n",
+ "#calculations\n",
+ "Ix_1 = log2(1/Px_1)#amount of information of zero level with base 2\n",
+ "Ix_2 = log2(1/Px_2)#amount of information of first level with base 2\n",
+ "Ix_1= log(1/Px_1)/log(2)#amount of information content with base 10\n",
+ "Ix_2= log(1/Px_2)/log(2)#amount of information content with base 10\n",
+ "\n",
+ "#results\n",
+ "print \"i.Amount of information carried wrt to binary PCM 0 (bits) = \",Ix_1\n",
+ "print \"ii.Amount of information carried wrt to binary PCM 1 (bits) = \",round(Ix_2,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Amount of information carried wrt to binary PCM 0 (bits) = 2.0\n",
+ "ii.Amount of information carried wrt to binary PCM 1 (bits) = 0.415\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9 - pg 492"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the entropy and Amount of information\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "\n",
+ "Px_1 = .4#probability of first symbol\n",
+ "Px_2 = .3#probability of second symbol\n",
+ "Px_3 = .2#probability of third symbol\n",
+ "Px_4 = .1#probability of fourth symbol\n",
+ "\n",
+ "#calculations\n",
+ "H_X = -Px_1*log2(Px_1)-Px_2*log2(Px_2)-Px_3*log2(Px_3)-Px_4*log2(Px_4);#entropy\n",
+ "Px1x2x1x3 = Px_1*Px_2*Px_1*Px_3;#product of probabilities\n",
+ "Ix1x2x1x3 =-log2(Px1x2x1x3);#information of four symbols\n",
+ "Px4x3x3x2 = Px_4*Px_3*Px_3*Px_2;#product of probabilities\n",
+ "Ix4x3x3x2 = -log2(Px4x3x3x2);#information of four symbols\n",
+ "\n",
+ "#results\n",
+ "print \"i.Entropy (bits/symbol) = \",round(H_X,2)\n",
+ "print \"ii.Amount of information contained in x1x2x1x3 (bits/symbol) = \",round(Ix1x2x1x3,2)\n",
+ "print \"Thus,Ix1x2x1x3 < 7.4[=4*H_X]bits/symbol\"\n",
+ "print \"iii.Amount of information contained in x4x3x3x2 (bits/symbol) = \",round(Ix4x3x3x2,2)\n",
+ "print \"\\nThus we conclude that\\nIx4x3x3x2 > 7.4[=4*H_X]bits/symbol\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Entropy (bits/symbol) = 1.85\n",
+ "ii.Amount of information contained in x1x2x1x3 (bits/symbol) = 6.7\n",
+ "Thus,Ix1x2x1x3 < 7.4[=4*H_X]bits/symbol\n",
+ "iii.Amount of information contained in x4x3x3x2 (bits/symbol) = 9.7\n",
+ "\n",
+ "Thus we conclude that\n",
+ "Ix4x3x3x2 > 7.4[=4*H_X]bits/symbol\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12 - pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the average rate of information convyed\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "\n",
+ "n = 2.*10**6#elements od black and white TV picture\n",
+ "m = 16.#brightness levels of black and white TV picture\n",
+ "o = 32.#repeated rate of pictures per second \n",
+ "\n",
+ "#calculations\n",
+ "Px_i = 1./m#probability of brightness levels of picture\n",
+ "H_X = 0;\n",
+ "for i in range (0,15):\n",
+ "\tH_Xi = (-1./(1./Px_i))*log2(1./(1./Px_i));\n",
+ "\tH_X = H_X +H_Xi\n",
+ "\n",
+ "r = n*o#rate of symbols generated \n",
+ "R = r*math.ceil(H_X)#average rate of information convyed \n",
+ " \n",
+ "#results\n",
+ "print \"i. Average rate of information convyed (Mbits/seconds) = \",R/10**6\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i. Average rate of information convyed (Mbits/seconds) = 256.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 13 - pg 495"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the average information rate\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "\n",
+ "t_dot = .2#duration of dot symbol\n",
+ "t_dash = .6#duration of dash symbol\n",
+ "t_space = .2#time between the symbols\n",
+ "#wkt sum of the probability is 1 i.e P_dot + P_dash = 1 hence\n",
+ "#P_dot = 2*P_dash weget \n",
+ "P_dot = 2./3#probality of dot symbol\n",
+ "P_dash = 1./3#probality of dash symbol\n",
+ "\n",
+ "#calculations \n",
+ "H_X = -P_dot*log2(P_dot)-P_dash*log2(P_dash);#entropy\n",
+ "T_s = P_dot*t_dot + P_dash*t_dash +t_space;#average time per symbol\n",
+ "r = 1/T_s;#average symbol rate \n",
+ "R = r*H_X;#average information rate of the telegraph sourece\n",
+ "\n",
+ "#result\n",
+ "print \"i.The average information rate of the telegraph source (bits/seconds) = \",round(R,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.The average information rate of the telegraph source (bits/seconds) = 1.722\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14 - pg 496"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the entropy and information rate\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "#given symbols are equally likely all the symbols the probabilities are same\n",
+ "Px_1 = 1./8;#probability of first symbol\n",
+ "Px_2 = 1./8;#probability of second symbol\n",
+ "Px_3 = 3./8;#probability of third symbol\n",
+ "Px_4 = 3./8;#probability of fourth symbol\n",
+ "\n",
+ "r = 2#average symbol rate from problem 11.14\n",
+ "\n",
+ "#calculaitons\n",
+ "H_X = Px_1*log2(1/Px_1) + Px_2*log2(1/Px_2) + Px_3*log2(1/Px_3) + Px_4*log2(1/Px_4);#entropy\n",
+ "R = H_X*r;#information rate\n",
+ "\n",
+ "#results\n",
+ "print \"i.Entropy (bits/symbol) = \",round(H_X,1)\n",
+ "print \"ii.The information rate of all symbols (f_m bits/seconds) = \", round(R,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Entropy (bits/symbol) = 1.8\n",
+ "ii.The information rate of all symbols (f_m bits/seconds) = 3.6\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15 - pg 497"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the information rate\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "#given symbols are equally likely all the symbols the probabilities are same\n",
+ "Px_1 = 1./4;#probability of first symbol\n",
+ "Px_2 = 1./4;#probability of second symbol\n",
+ "Px_3 = 1./4;#probability of third symbol\n",
+ "Px_4 = 1./4;#probability of fourth symbol\n",
+ "r = 2#average symbol rate from problem 11.14\n",
+ "\n",
+ "#calculaitons\n",
+ "H_X = Px_1*log2(1/Px_1) + Px_2*log2(1/Px_2) + Px_3*log2(1/Px_3) + Px_4*log2(1/Px_4);#entropy\n",
+ "R = H_X*r;#information rate\n",
+ "\n",
+ "#results\n",
+ "print \"i.The information rate of all symbols (f_m bits/seconds) = \", R\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.The information rate of all symbols (f_m bits/seconds) = 4.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16 - pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Entropy and rate of information\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "Px_1 = 1./2;#probability of first symbol\n",
+ "Px_2 = 1./4;#probability of second symbol\n",
+ "Px_3 = 1./8;#probability of third symbol\n",
+ "Px_4 = 1./16;#probability of fourth symbol\n",
+ "Px_4 = 1./16;#probability of fifth symbol\n",
+ "T_b = 1*10**-3#time required for emittion of each symbol\n",
+ "r = 1./(T_b)#symbol rate\n",
+ "\n",
+ "#calculations\n",
+ "H_X = Px_1*log2(1/Px_1) + Px_2*log2(1/Px_2) + Px_3*log2(1/Px_3) + Px_4*log2(1/Px_4) + Px_4*log2(1/Px_4);\n",
+ "R = r*H_X;#information rate\n",
+ "\n",
+ "#results\n",
+ "print \"i.Entropy of five symbols (bits/symbol) = \",H_X\n",
+ "print \"ii.Rate of information (bits/sec) = \",R\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Entropy of five symbols (bits/symbol) = 1.875\n",
+ "ii.Rate of information (bits/sec) = 1875.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 17 - pg 498"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the rate of information\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "Px_1 = 1./2;#probability of first symbol\n",
+ "Px_2 = 1./4;#probability of second symbol\n",
+ "Px_3 = 1./8;#probability of third symbol\n",
+ "Px_4 = 1./16;#probability of fourth symbol\n",
+ "Px_5 = 1./16;#probability of fifth symbol\n",
+ "r = 16#outcomes per second\n",
+ "\n",
+ "#calculations\n",
+ "H_X = Px_1*log2(1/Px_1) + Px_2*log2(1/Px_2) + Px_3*log2(1/Px_3) + Px_4*log2(1/Px_4) + Px_5*log2(1/Px_5);\n",
+ "R = r*H_X;#information rate\n",
+ "\n",
+ "#result\n",
+ "print \"Rate of information (bits/sec) = \",R\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rate of information (bits/sec) = 30.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 18 - pg 499"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the rate of information\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "Px_1 = 1./4;#probability of first symbol\n",
+ "Px_2 = 1./5;#probability of second symbol\n",
+ "Px_3 = 1./5;#probability of third symbol\n",
+ "Px_4 = 1./10;#probability of fourth symbol\n",
+ "Px_5 = 1./10;#probability of fifth symbol\n",
+ "Px_6 = 1./20;#probability of sixth symbol\n",
+ "Px_7 = 1./20;#probability of seventh symbol\n",
+ "Px_8 = 1./20;#probability of eigith symbol\n",
+ "f_m = 10*10**3#freuency of tranamitting symbol\n",
+ "\n",
+ "#calculations\n",
+ "H_X = Px_1*log2(1/Px_1) + Px_2*log2(1/Px_2) + Px_3*log2(1/Px_3) + Px_4*log2(1/Px_4) + Px_5*log2(1/Px_5) + Px_6*log2(1/Px_6)+ Px_7*log2(1/Px_7)+ Px_8*log2(1/Px_8);#entropy\n",
+ "f_s = 2*f_m#sampling frequency\n",
+ "r = f_s#sampling frequency equal to rate of transmission\n",
+ "R = r*H_X;#information rate\n",
+ "\n",
+ "#result\n",
+ "print \"Rate of information (bits/sec) = \",round(R,0)\n",
+ "print \"Note:Their mistake in calculation of H_X in textbook\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rate of information (bits/sec) = 54829.0\n",
+ "Note:Their mistake in calculation of H_X in textbook\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 19 - pg 502"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the channel matrix\n",
+ "import numpy\n",
+ "#given\n",
+ "#from fig\n",
+ "P_X = numpy.matrix([.5, .5])#x matrix\n",
+ "P_Xd = numpy.matrix([[.5, 0],[0, .5]])#diagonal x matrix\n",
+ "#calculations\n",
+ "P_YX = numpy.matrix([[.9, .1],[.2, .8]]);#yx matrix representation of given fig\n",
+ "P_Y = P_X*P_YX#y matrix\n",
+ "P_XY = P_Xd * P_YX#xy matrix\n",
+ "\n",
+ "#results\n",
+ "print \"i.Channel matrix of the channelP_YX \"\n",
+ "print(P_YX)\n",
+ "print \"ii.a.P(y1) =\",P_Y[0,0]\n",
+ "print \" b.P(y2) = \",P_Y[0,1]\n",
+ "print \"iii.a.P(x1,y2) = \",P_XY[0,1]\n",
+ "print \" b.P(x2,y1) = \",P_XY[1,0]\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Channel matrix of the channelP_YX \n",
+ "[[ 0.9 0.1]\n",
+ " [ 0.2 0.8]]\n",
+ "ii.a.P(y1) = 0.55\n",
+ " b.P(y2) = 0.45\n",
+ "iii.a.P(x1,y2) = 0.05\n",
+ " b.P(x2,y1) = 0.1\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 20 - pg 503"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Channel matrix\n",
+ "import numpy\n",
+ "#given\n",
+ "P_X = numpy.matrix([.5, .5])#x matrix\n",
+ "#calculations\n",
+ "P_YX = numpy.matrix([[.9, .1],[.2, .8]]);#yx matrix representation of given fig\\\n",
+ "P_ZY = numpy.matrix([[.9, .1],[.2, .8]]);#yx matrix representation of given fig\n",
+ "P_Y = P_X *P_YX#y matrix\n",
+ "P_ZX = P_YX * P_ZY#zx matrix\n",
+ "P_Z = P_X *P_ZX#z matrix\n",
+ "\n",
+ "\n",
+ "#results\n",
+ "print \"i.Channel matrix of the channelP_ZX \"\n",
+ "print(P_ZX)\n",
+ "print(\"Matrix P(Z)\")\n",
+ "print(P_Z)\n",
+ "print \"a.P(Z1) = \",P_Z[0,0]\n",
+ "print \"b.P(Z2) = \",P_Z[0,1]\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Channel matrix of the channelP_ZX \n",
+ "[[ 0.83 0.17]\n",
+ " [ 0.34 0.66]]\n",
+ "Matrix P(Z)\n",
+ "[[ 0.585 0.415]]\n",
+ "a.P(Z1) = 0.585\n",
+ "b.P(Z2) = 0.415\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21 - pg 504"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the probability associated with channel outputs\n",
+ "#given\n",
+ "import numpy\n",
+ "P_X = numpy.matrix([.5, .5])#x matrix\n",
+ "P_YX = numpy.matrix([[.8, .2, 0], [0, .2, .8]]);#yx matrix representation of given fig\n",
+ "\n",
+ "#calculations\n",
+ "P_Y = P_X*P_YX;\n",
+ "\n",
+ "#results\n",
+ "print \"probability associated with the channel outputs for p=.2 is\"\n",
+ "print(P_Y)\n",
+ "print \"a.P(Y1) = \",P_Y[0,0]\n",
+ "print \"b.P(Y2) = \",P_Y[0,1]\n",
+ "print \"C.P(Y3) = \",P_Y[0,2]\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "probability associated with the channel outputs for p=.2 is\n",
+ "[[ 0.4 0.2 0.4]]\n",
+ "a.P(Y1) = 0.4\n",
+ "b.P(Y2) = 0.2\n",
+ "C.P(Y3) = 0.4\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 28 - pg 504"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the I_XY value\n",
+ "import numpy\n",
+ "import math\n",
+ "from math import log\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "#given\n",
+ "#wkt P_Y = P_X*P_YX from previous problems\n",
+ "alfa = .5\n",
+ "P_1 = .1#probability for first case\n",
+ "P_2 = .5#probability for second case\n",
+ "\n",
+ "#calculations\n",
+ "P_X = numpy.matrix([alfa, alfa]);\n",
+ "#first case\n",
+ "P_YX = ([[1-P_1, P_1],[P_1, 1-P_1]]);\n",
+ "P_Y1 = P_X*P_YX;\n",
+ "H_Y1 = -P_Y1[0,0]*log2(P_Y1[0,0])-P_Y1[0,1]*log2(P_Y1[0,1]);\n",
+ "Q_1 = P_1*log2(P_1) + (1-P_1)*log2(1-P_1)#from proof\n",
+ "I_XY1 = 1 + Q_1;\n",
+ "#second case\n",
+ "P_YX = ([[1-P_2, P_2],[P_2, 1-P_2]]);\n",
+ "P_Y2 = P_X*P_YX;\n",
+ "H_Y2 = -P_Y2[0,0]*log2(P_Y2[0,0])-P_Y2[0,1]*log2(P_Y2[0,1]);\n",
+ "Q_2 = P_2*log2(P_2) + (1-P_2)*log2(1-P_2)#from proof \n",
+ "I_XY2 = 1 + Q_2;\n",
+ "\n",
+ "#results\n",
+ "print \"I_XY for the first case = \",round(I_XY1,3)\n",
+ "print \"I_XY for the second case = \",round(I_XY2,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "I_XY for the first case = 0.531\n",
+ "I_XY for the second case = 0.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 32 - pg 518"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Entropy in all cases\n",
+ "import math\n",
+ "from math import log\n",
+ "\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "#given\n",
+ "a1 = 1.\n",
+ "a2 = 2.\n",
+ "a3 = .5\n",
+ "\n",
+ "#calculations\n",
+ "H_X1 = log2(a1);#Entropy for first case\n",
+ "H_X2 = log2(a2);#Entropy for second case\n",
+ "H_X3 = log2(a3);#Entropy for third case\n",
+ "\n",
+ "#results\n",
+ "print \"i.Entropy for first case = \",H_X1\n",
+ "print \"ii.Entropy for second case = \",H_X2\n",
+ "print \"iii.Entropy for third case = \",H_X3\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Entropy for first case = 0.0\n",
+ "ii.Entropy for second case = 1.0\n",
+ "iii.Entropy for third case = -1.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 35 - pg 520"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the capacity of channel\n",
+ "\n",
+ "import math\n",
+ "from math import log\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "#given\n",
+ "B = 4000.#bandwidth of AWGN channel\n",
+ "S = .1*10**-3#power of signal\n",
+ "neta = 2*10**-12#spectral dencity \n",
+ "N = neta*B;#power \n",
+ "\n",
+ "#calculations \n",
+ "C = B * log2(1 + (S/N));#capacity of channel\n",
+ "\n",
+ "#result\n",
+ "print \"Capacity of channel (b/s) = \",round(C,0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Capacity of channel (b/s) = 54439.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 36 - pg 521"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the information rate, bandwidth and S/N ratio\n",
+ "import math\n",
+ "from math import log\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "#given\n",
+ "fm=4000. #Hz\n",
+ "tim=1.25\n",
+ "Pi=1/256.\n",
+ "SN=100.\n",
+ "#calculations \n",
+ "fs=2*fm\n",
+ "r=fs*tim\n",
+ "H=log2(1/Pi)\n",
+ "R=r*H\n",
+ "C = r* log2(1 + SN);#capacity of channel\n",
+ "SN2=(1/Pi-1)\n",
+ "B2=R/log2(1+SN)\n",
+ "#result\n",
+ "print \"information rate of source (kb/s) = \",R/1000.\n",
+ "print \"Capacity of channel (b/s) = \",round(C,0)\n",
+ "print \"Final S/N ratio = \",SN2\n",
+ "print \"bandwidth required (kHz) = \",round(B2/1000.,0)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "information rate of source (kb/s) = 80.0\n",
+ "Capacity of channel (b/s) = 66582.0\n",
+ "Final S/N ratio = 255.0\n",
+ "bandwidth required (kHz) = 12.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 37 - pg 524"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the efficiency of code and code redundancy\n",
+ "\n",
+ "import math\n",
+ "from math import log\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "#given\n",
+ "Px_1 = 0.9#probability of first symbol\n",
+ "Px_2 = 0.1#probability of second symbol\n",
+ "n1 = 1.#length of the code for x_1\n",
+ "n2 =1.#length of code for x_2\n",
+ "\n",
+ "#calculations\n",
+ "#we know that the average code length L per symbol\n",
+ "L = Px_1*n1 + Px_2*n2#code length\n",
+ "H_X = -Px_1*log2(Px_1) - Px_2*log2(Px_2) #entropy\n",
+ "neta = H_X/L#efficiency \n",
+ "neta1 = neta*100#neta in percentage\n",
+ "gama = 1 - neta#redundancy\n",
+ "gama1 = gama*100#gama in percentage\n",
+ "\n",
+ "#results\n",
+ "print \"i.Efficiency of code (percent) = \",round(neta1,1)\n",
+ "print \"ii.Code redundancy (percent) = \",round(gama1,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Efficiency of code (percent) = 46.9\n",
+ "ii.Code redundancy (percent) = 53.1\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 38 - pg 524"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the efficiency of code and code redundancy\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "Px_1 = 0.81#probability of first symbol\n",
+ "Px_2 = .09#probability of second symbol\n",
+ "Px_3 = .09#probability of third symbol\n",
+ "Px_4 = 0.01#probability of forth symbol\n",
+ "n1 = 1.#length of code for a_1\n",
+ "n2 =2.#length of code for a_2\n",
+ "n3 = 3.#length of code for a_3\n",
+ "n4 = 3.#length of code for a_4\n",
+ "\n",
+ "#calculations\n",
+ "#we know that the average code length L per symbol\n",
+ "L = Px_1*n1 + Px_2*n2 + Px_3*n3 + Px_4*n4 #code length\n",
+ "H_X = -Px_1*log2(Px_1) - Px_2*log2(Px_2) - Px_3*log2(Px_3) - Px_4*log2(Px_4)#entropy \n",
+ "neta = H_X/L#efficiency \n",
+ "neta1 = neta*100#neta in percentage\n",
+ "gama = 1 - neta#redundancy\n",
+ "gama1 = gama*100#gama in percentage\n",
+ "\n",
+ "#results\n",
+ "print \"i.Efficiency of code (percent) = \",round(neta1,1)\n",
+ "print \"ii.Code redundancy (percent) = \",round(gama1,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Efficiency of code (percent) = 72.7\n",
+ "ii.Code redundancy (percent) = 27.3\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 44 - pg 529"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the efficiency \n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "P_x1 = 1./2#probability of first symbol\n",
+ "P_x2 = 1./4#probability of second symbol\n",
+ "P_x3 = 1./8#probability of third symbol\n",
+ "P_x4 = 1./8#probability of fouth symbol\n",
+ "n1 = 1.\n",
+ "n2 = 2.\n",
+ "n3 = 3.\n",
+ "n4 = 3.\n",
+ "\n",
+ "#calculations\n",
+ "I_x1 = -log2(P_x1);\n",
+ "I_x2 = -log2(P_x2);\n",
+ "I_x3 = -log2(P_x3);\n",
+ "I_x4 = -log2(P_x4);\n",
+ "H_x = P_x1*I_x1 + P_x2*I_x2 + P_x3*I_x3 + P_x4*I_x4;\n",
+ "L = P_x1*n1 + P_x2*n2 + P_x3*n3 + P_x4*n4;\n",
+ "neta = H_x/L;\n",
+ "P_neta = neta*100#efficiency in percentage\n",
+ "\n",
+ "#results\n",
+ "print \"Efficiency = \",neta\n",
+ "print \"Efficiency in percentage (percent) = \",P_neta\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Efficiency = 1.0\n",
+ "Efficiency in percentage (percent) = 100.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 45 - pg 532"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the efficiency using shannon code and huffman code\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "P_x1 = .2#probability of first signal\n",
+ "P_x2 = .2#probability of second signal\n",
+ "P_x3 = .2#probability of third signal\n",
+ "P_x4 = .2#probability of fourth signal\n",
+ "P_x5 = .2#probability of fifth signal\n",
+ "n1 = 2.#number of bits in code obtained from table given textbook\n",
+ "n2 = 2.#number of bits in code obtained from table given textbook\n",
+ "n3 = 2.#number of bits in code obtained from table given textbook\n",
+ "n4 = 3.#number of bits in code obtained from table given textbook\n",
+ "n5 = 3.#number of bits in code obtained from table given textbook\n",
+ "\n",
+ "#calculations\n",
+ "I_x1 = -log2(P_x1);\n",
+ "I_x2 = -log2(P_x2);\n",
+ "I_x3 = -log2(P_x3);\n",
+ "I_x4 = -log2(P_x4);\n",
+ "I_x5 = -log2(P_x5);\n",
+ "H_x = P_x1*I_x1 + P_x2*I_x2 + P_x3*I_x3 + P_x4*I_x4 + P_x5*I_x5;#entropy\n",
+ "L1 = P_x1*n1 + P_x2*n2 + P_x3*n3 + P_x4*n4 + P_x5*n5;\n",
+ "neta1 = H_x/L1;\n",
+ "P_neta1 = neta1*100#efficiency in percentage using Shannon Fano code\n",
+ "L2 = P_x1*n1 + P_x2*n2 + P_x3*n3 +P_x4*n4 +P_x5*n5\n",
+ "neta2 = H_x/L2;\n",
+ "P_neta2 = neta2*100#efficiency in percentage using huffman code\n",
+ "\n",
+ "#results\n",
+ "print \"Efficiency in percentage using Shannon Fano code (percent) = \",round(P_neta1,1)\n",
+ "print \"Efficiency in percentage using huffman code (percent) = \",round(P_neta2,1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Efficiency in percentage using Shannon Fano code (percent) = 96.7\n",
+ "Efficiency in percentage using huffman code (percent) = 96.7\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 46 - pg 532"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the efficiency using shannon code and huffman code\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "P_x1 = .4#probability of first signal\n",
+ "P_x2 = .19#probability of second signal\n",
+ "P_x3 = .16#probability of third signal\n",
+ "P_x4 = .15#probability of fourth signal\n",
+ "P_x5 = .1#probability of fifth signal\n",
+ "n1 = 1.#number of bits in code obtained from table given textbook\n",
+ "n2 = 2.#number of bits in code obtained from table given textbook\n",
+ "n3 = 2.#number of bits in code obtained from table given textbook\n",
+ "n4 = 3.#number of bits in code obtained from table given textbook\n",
+ "n5 = 3.#number of bits in code obtained from table given textbook\n",
+ "\n",
+ "#calculations\n",
+ "I_x1 = -log2(P_x1);\n",
+ "I_x2 = -log2(P_x2);\n",
+ "I_x3 = -log2(P_x3);\n",
+ "I_x4 = -log2(P_x4);\n",
+ "I_x5 = -log2(P_x5);\n",
+ "H_x = P_x1*I_x1 + P_x2*I_x2 + P_x3*I_x3 + P_x4*I_x4 + P_x5*I_x5;#entropy\n",
+ "L1 = P_x1*n1 + P_x2*n2 + P_x3*n3 + P_x4*n4 + P_x5*n5;\n",
+ "neta1 = H_x/L1;\n",
+ "P_neta1 = neta1*100#efficiency in percentage using Shannon Fano code\n",
+ "L2 = P_x1*1 + (P_x2 + P_x3 +P_x4 +P_x5 )*3\n",
+ "neta2 = H_x/L2;\n",
+ "P_neta2 = neta2*100#efficiency in percentage using huffman code\n",
+ "\n",
+ "#results\n",
+ "print \"Efficiency in percentage using Shannon Fano code (percent) = \",round(P_neta1,1)\n",
+ "print \"Efficiency in percentage using huffman code (percent) = \",round(P_neta2,1)\n",
+ "print \"Note: There is mistake in the textbook in calculation of L using SHannon Fano code\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Efficiency in percentage using Shannon Fano code (percent) = 116.2\n",
+ "Efficiency in percentage using huffman code (percent) = 97.7\n",
+ "Note: There is mistake in the textbook in calculation of L using SHannon Fano code\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 47 - pg 532"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Efficiency\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "P_x1 = .05#probability of first signal\n",
+ "P_x2 = .15#probability of second signal\n",
+ "P_x3 = .2#probability of third signal\n",
+ "P_x4 = .05#probability of fourth signal\n",
+ "P_x5 = .15#probability of fifth signal\n",
+ "P_x6 = .3#probability of sixth signal\n",
+ "P_x7 = .1#probability of seventh signal\n",
+ "n1 = 4.#number of bits in code obtained from table given textbook\n",
+ "n2 = 3.#number of bits in code obtained from table given textbook\n",
+ "n3 = 2.#number of bits in code obtained from table given textbook\n",
+ "n4 = 4.#number of bits in code obtained from table given textbook\n",
+ "n5 = 3.#number of bits in code obtained from table given textbook\n",
+ "n6 = 2.#number of bits in code obtained from table given textbook\n",
+ "n7 = 3.#number of bits in code obtained from table given textbook\n",
+ "\n",
+ "#calculations\n",
+ "I_x1 = -log2(P_x1);\n",
+ "I_x2 = -log2(P_x2);\n",
+ "I_x3 = -log2(P_x3);\n",
+ "I_x4 = -log2(P_x4);\n",
+ "I_x5 = -log2(P_x5);\n",
+ "I_x6 = -log2(P_x6);\n",
+ "I_x7 = -log2(P_x7);\n",
+ "H_x = P_x1*I_x1 + P_x2*I_x2 + P_x3*I_x3 + P_x4*I_x4 + P_x5*I_x5 + P_x6*I_x6 + P_x7*I_x7;#entropy\n",
+ "L = P_x1*n1 + P_x2*n2 + P_x3*n3 + P_x4*n4 + P_x5*n5 + P_x6*n6 + P_x7*n7;\n",
+ "neta = (H_x*100)/L#Efficiency in percentage\n",
+ "\n",
+ "#results\n",
+ "print \"Efficiency in percentage (percent) = \",round(neta,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Efficiency in percentage (percent) = 98.88\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 49 - pg 534"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Variance of codeword length\n",
+ "\n",
+ "#given\n",
+ "P_x1 = .4#probability of first signal\n",
+ "P_x2 = .2#probability of second signal\n",
+ "P_x3 = .8#probability of third signal\n",
+ "P_x4 = .08#probability of fourth signal\n",
+ "P_x5 = .02#probability of fifth signal\n",
+ "n1 = 2.#number of bits in code obtained from table given textbook\n",
+ "n2 = 3.#number of bits in code obtained from table given textbook\n",
+ "n3 = 1.#number of bits in code obtained from table given textbook\n",
+ "n4 = 4.#number of bits in code obtained from table given textbook\n",
+ "n5 = 4.#number of bits in code obtained from table given textbook\n",
+ "\n",
+ "#calculations\n",
+ "L = P_x1*n1 + P_x2*n2 + P_x3*n3 + P_x4*n4 + P_x5*n5;#average codeword length per symbol\n",
+ "#since sigma = sqrt(summation of product of probability and (n- L)**2)\n",
+ "sigmasquare = P_x1*(n1-L)**2 + P_x2*(n2-L)**2 +P_x3*(n3-L)**2 + P_x4*(n4-L)**2 +P_x5*(n5-L)**2;#Variance of codewoed length\n",
+ "\n",
+ "#results\n",
+ "print \"Variance of codeword length = \",sigmasquare\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Variance of codeword length = 2.42\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 50 - pg 535"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Entropy and Information rate\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "P_x1 = 1./2#probability of first signal\n",
+ "P_x2 = 1./4#probability of second signal\n",
+ "P_x3 = 1./8#probability of third signal\n",
+ "P_x4 = 1./16#probability of fourth signal\n",
+ "P_x5 = 1./32#probability of fifth signal\n",
+ "P_x6 = 1./32#probability of sixth signal\n",
+ "r = 16#message rate in outcomes per second\n",
+ "\n",
+ "#calculations\n",
+ "I_x1 = -log2(P_x1);\n",
+ "I_x2 = -log2(P_x2);\n",
+ "I_x3 = -log2(P_x3);\n",
+ "I_x4 = -log2(P_x4);\n",
+ "I_x5 = -log2(P_x5);\n",
+ "I_x6 = -log2(P_x6);\n",
+ "H_X = P_x1*I_x1 + P_x2*I_x2 + P_x3*I_x3 + P_x4*I_x4 + P_x5*I_x5 + P_x6*I_x6 #entropy\n",
+ "R = H_X*r#Information rate\n",
+ "\n",
+ "#results\n",
+ "print \"Entropy of the system (bits/message) = \",H_X\n",
+ "print \"Information rate (bits/seconds) = \",R\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Entropy of the system (bits/message) = 1.9375\n",
+ "Information rate (bits/seconds) = 31.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 51 - pg 535"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Entropy\n",
+ "import numpy\n",
+ "#given\n",
+ "import math\n",
+ "from math import log\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "P_x1 = .3#probability of first signal\n",
+ "P_x2 = .4#probability of second signal\n",
+ "P_x3 = .3#probability of third signal\n",
+ "P_YX = numpy.matrix([[.8, .2, 0],[0, .1, 0],[0, .3, 0.7]])#matrix obtained from the figure \n",
+ "\n",
+ "#calculations\n",
+ "I_x1 = -log2(P_x1);\n",
+ "I_x2 = -log2(P_x2);\n",
+ "I_x3 = -log2(P_x3);\n",
+ "H_X = P_x1*I_x1 + P_x2*I_x2 + P_x3*I_x3 #entropy\n",
+ "P_y1 = P_YX[0,0]*P_x1 + P_YX[0,1]*P_x1 + P_YX[0,2]*P_x1;\n",
+ "P_y2 = P_YX[1,0]*P_x2 + P_YX[1,1]*P_x2 + P_YX[1,2]*P_x2;\n",
+ "P_y3 = P_YX[2,0]*P_x3 + P_YX[2,1]*P_x3 + P_YX[2,2]*P_x3;\n",
+ "I_y1 = -log2(P_y1);\n",
+ "I_y2 = -log2(P_y2);\n",
+ "I_y3 = -log2(P_y3);\n",
+ "H_Y = -P_y1*I_y1 - P_y2*I_y2 - P_y3*I_y3 #entropy\n",
+ "\n",
+ "#results\n",
+ "print \" Entropy H(X) = \",round(H_X,3)\n",
+ "print \"Entropy H(Y) = \",round(H_Y,3)\n",
+ "print \" Note:There is mistake in the calculation of P_y3 in the textbook so their is change in entropy H_Y\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Entropy H(X) = 1.571\n",
+ "Entropy H(Y) = -1.228\n",
+ " Note:There is mistake in the calculation of P_y3 in the textbook so their is change in entropy H_Y\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 52 - pg 536"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Entropy of the second order extension\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "\n",
+ "P_x1 = .7#probability of first signal\n",
+ "P_x2 = .15#probability of second signal\n",
+ "P_x3 = .15#probability of third signal\n",
+ "n = 2#second order extention\n",
+ "\n",
+ "#calculations\n",
+ "I_x1 = -log2(P_x1);\n",
+ "I_x2 = -log2(P_x2);\n",
+ "I_x3 = -log2(P_x3);\n",
+ "H_x = P_x1*I_x1 + P_x2*I_x2 + P_x3*I_x3#entropy\n",
+ "H_x2 = n*H_x#entropy of second order extention\n",
+ "\n",
+ "#results\n",
+ "print \"Entropy of second order extension (bits/symbol) = \",round(H_x2,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Entropy of second order extension (bits/symbol) = 2.363\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 54 - pg 537"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Entropy of the source\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "\n",
+ "#given\n",
+ "P_x1 = 1./3#probability of first signal\n",
+ "P_x2 = 1./6#probability of second signal\n",
+ "P_x3 = 1./4#probability of third signal\n",
+ "P_x4 = 1./4#probability of fourth signal\n",
+ "\n",
+ "#calculations\n",
+ "I_x1 = -log2(P_x1);\n",
+ "I_x2 = -log2(P_x2);\n",
+ "I_x3 = -log2(P_x3);\n",
+ "I_x4 = -log2(P_x4);\n",
+ "H_x = P_x1*I_x1 + P_x2*I_x2 + P_x3*I_x3 + P_x4*I_x4 #entropy\n",
+ "\n",
+ "#results\n",
+ "print \"Entropy of the source (bits/symbol) = \",round(H_x,4)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Entropy of the source (bits/symbol) = 1.9591\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 55 - pg 538"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Average number of bits per message\n",
+ "\n",
+ "#given\n",
+ "P_x1 = 1./2#probability of first signal\n",
+ "P_x2 = 1./4#probability of second signal\n",
+ "P_x3 = 1./8#probability of third signal\n",
+ "P_x4 = 1./16#probability of fourth signal\n",
+ "P_x5 = 1./16#probability of fifth signal\n",
+ "n1 = 1.#number of bits in code obtained from table given textbook\n",
+ "n2 = 2.#number of bits in code obtained from table given textbook\n",
+ "n3 = 3.#number of bits in code obtained from table given textbook\n",
+ "n4 = 4.#number of bits in code obtained from table given textbook\n",
+ "n5 = 4.#number of bits in code obtained from table given textbook\n",
+ "\n",
+ "#calculations\n",
+ "L = P_x1*n1 + P_x2*n2 + P_x3*n3 + P_x4*n4 + P_x5*n5;#Average number of bits per message\n",
+ "\n",
+ "#results\n",
+ "print \"Average number of bits per message (bits) = \",L\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Average number of bits per message (bits) = 1.875\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 56 - pg 538"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Information capacity of telephone channel\n",
+ "import math\n",
+ "from math import log,exp\n",
+ "#given\n",
+ "def log2(x):\n",
+ "\ty=log(x)/log(2)\n",
+ " \treturn y\n",
+ "B = 3.4*10**3#bandwidth\n",
+ "SbyN = 30#signal to the noise ratio in dB\n",
+ "\n",
+ "\n",
+ "#calculations\n",
+ "SbyN1 = exp((SbyN/10)*log(10))#signal to noise ratio \n",
+ "C = B*log2(1+SbyN1);\n",
+ "\n",
+ "#result\n",
+ "print \"Information capacity of the telephone channel (kbps) = \",round(C/1000.,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Information capacity of the telephone channel (kbps) = 33.89\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Analog_and_digital_communication_by_S_Sharma/Chapter2.ipynb b/Analog_and_digital_communication_by_S_Sharma/Chapter2.ipynb
new file mode 100755
index 00000000..8aec144e
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/Chapter2.ipynb
@@ -0,0 +1,948 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:a7e69d66c75dc0139f1d4e508c61265803ca8633ed9b66021344d2bb2ddea0cd"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2 - Amplitude Modulation"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - pg 51"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calcualate the carrier frequency\n",
+ "#given\n",
+ "import math\n",
+ "L = 50*10**-6#in henry\n",
+ "C = 1*10**-9#in farads\n",
+ "#calculation\n",
+ "F_c = 1/(2.*math.pi*math.sqrt(L*C))/1000.;\n",
+ "#results\n",
+ "print '%s %d %s' %(\"Carrier frequency F_c =\",math.ceil(F_c),\" kHz\")\n",
+ "print(\"Now , it is given that the highest modulation frequency is 8KHz \");\n",
+ "print(\"Therefore, the frequency range occupied by the sidebands will range from 8KHz \\nabove to 8KHz below the carrier frequency, extending fom 712KHz to 720KHz.\");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Carrier frequency F_c = 712 kHz\n",
+ "Now , it is given that the highest modulation frequency is 8KHz \n",
+ "Therefore, the frequency range occupied by the sidebands will range from 8KHz \n",
+ "above to 8KHz below the carrier frequency, extending fom 712KHz to 720KHz.\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - pg 51"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index, upper and lower sideband frequency, bandwidth of modulation signal\n",
+ "\n",
+ "\n",
+ "#given\n",
+ "#v_m = 10*sin(2*%pi*10^3*t)\n",
+ "#by comparing with v_m = V_m*sin(2*%pi*f_c*t) we get\n",
+ "V_m = 10.#in volts\n",
+ "f_m = 1*10**3#in hertz\n",
+ "V_c = 20.#in volts\n",
+ "f_c = 1*10**4#in hertz\n",
+ "\n",
+ "#calculations\n",
+ "m_a = V_m/V_c;#modulation index formula\n",
+ "m_a1 = m_a*100;#percentage modulation index\n",
+ "f_usb = f_c + f_m;#Upper sideband\n",
+ "f_lsb = f_c - f_m;#lower sideband\n",
+ "A = (m_a*V_c)/2#amplitude of upper as well as lower sideband\n",
+ "B = 2*f_m;#bandwidth of the modulation signal\n",
+ "\n",
+ "#results\n",
+ "print '%s %.2f' %(\"i.a.Modulation index= \",m_a);\n",
+ "print '%s %d %s' %(\" b.Percentage modulation index=\",m_a1,\" percent\");\n",
+ "print '%s %.f %s' %(\"ii.a.Upper sidebandfrequency=\",f_usb,\"Hz\");\n",
+ "print '%s %.f %s' %(\" b.Lower sideband frequency=\",f_lsb,\"Hz \"); \n",
+ "print '%s %.f %s' %(\"iii.Amplitude of Upper sideband and Lower sideband =\",A,\"V\");\n",
+ "print '%s %.f %s' %(\"\\iv.Bandwidth of the modulation signal=\",B,\"Hz\");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.a.Modulation index= 0.50\n",
+ " b.Percentage modulation index= 50 percent\n",
+ "ii.a.Upper sidebandfrequency= 11000 Hz\n",
+ " b.Lower sideband frequency= 9000 Hz \n",
+ "iii.Amplitude of Upper sideband and Lower sideband = 5 V\n",
+ "\\iv.Bandwidth of the modulation signal= 2000 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - pg 54"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the total power in the amplitude modulated wave\n",
+ "\n",
+ "\n",
+ "#given\n",
+ "m_a = .75;#modulation index\n",
+ "P_c = 400.;#carrier power in watts\n",
+ "\n",
+ "#calculation\n",
+ "P_t = P_c*(1+(m_a**2/2));#total power \n",
+ "\n",
+ "#results\n",
+ "print \"Total power in the amplitude modulated wave (in W) = \",P_t;\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total power in the amplitude modulated wave (in W) = 512.5\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4 - pg 54"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier power\n",
+ "#given\n",
+ "P_t = 10*10**3;#total power in watts\n",
+ "m_a = .6;#modulation index\n",
+ "#calculation\n",
+ "P_c = (P_t/(1+(m_a**2/2)));# carrier power\n",
+ "#results\n",
+ "print \"Carrier power (in kW) = \",round(P_c/1000.,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Carrier power (in kW) = 8.47\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5 - pg 55"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index and antenna current\n",
+ "\n",
+ "import math\n",
+ "#given\n",
+ "I_t = 8.93;#total modulated current in ampers\n",
+ "I_c= 8;#carrier or unmodulated current in ampers\n",
+ "#calculation\n",
+ "m_a = math.sqrt(2*((I_t/I_c)**2 -1));#formula for modulation index\n",
+ "M_a=m_a*100;#percentage modulation\n",
+ "#for \n",
+ "m_a1 = .8;#given modulation index\n",
+ "\n",
+ "#calculation\n",
+ "I_t1 = I_c*math.sqrt(1+(m_a1**2/2));#new antenna current \n",
+ "\n",
+ "#results\n",
+ "print \"i.a. Modulation index = \",round(m_a,3)\n",
+ "print \"b.Percentage modulation index (percent) = \",round(M_a,1)\n",
+ "print \"ii. Antenna current (in A) = \",round(I_t1,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.a. Modulation index = 0.701\n",
+ "b.Percentage modulation index (percent) = 70.1\n",
+ "ii. Antenna current (in A) = 9.19\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6 - pg 56"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier signal current, modulation indexes\n",
+ "import math\n",
+ "#given\n",
+ "I_t1 = 10#antenna current in amps\n",
+ "m1 = .3#modulation index\n",
+ "I_t2 = 11#increased antenna current\n",
+ "\n",
+ "#calculation\n",
+ "I_c = (I_t1/(1+(m1**2/2))**.5);#formula for carrier signal current\n",
+ "m_t = math.sqrt(2*((I_t2/I_c)**2 -1));#formula for modulation index\n",
+ "m2 = math.sqrt(m_t**2 - m1**2);\n",
+ "m3 = m2*100;#percentage modulation index\n",
+ "\n",
+ "#results\n",
+ "print \"i.Carrier signal current (in A) = \",round(I_c,2)\n",
+ "print \"ii.Modulation index of signal = \",round(m_t,2)\n",
+ "print \"iii.a.Modulation index of second signal = \",round(m2,2)\n",
+ "print \"b.Percentage modulation index of second signal (percent) = \",round(m3,0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Carrier signal current (in A) = 9.78\n",
+ "ii.Modulation index of signal = 0.73\n",
+ "iii.a.Modulation index of second signal = 0.66\n",
+ "b.Percentage modulation index of second signal (percent) = 66.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7 - pg 56"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulating. maximum, minimum voltage\n",
+ "\n",
+ "#given v_c = 10*sinwt\n",
+ "\n",
+ "m = .5#modulation index\n",
+ "#by comparing with v_c = V_c*sinwt\n",
+ "V_c = 10#carrier voltage in volts\n",
+ "\n",
+ "#calculation\n",
+ "V_m = m*V_c;#amplitude of modulating index\n",
+ "V_max = V_c + V_m;#maximum voltage\n",
+ "V_min = V_c - V_m;#minimum voltage\n",
+ "\n",
+ "#results\n",
+ "print \" i.Modulating voltage =\",round(V_m,2),\"V\" \n",
+ "print \" ii. Maximum voltage =\",round(V_max,2),\"V\"\n",
+ "print \" iii.Minimum voltage =\",round(V_min,2),\"V\" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " i.Modulating voltage = 5.0 V\n",
+ " ii. Maximum voltage = 15.0 V\n",
+ " iii.Minimum voltage = 5.0 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9 - pg 57"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the percentag4e modulation index\n",
+ "\n",
+ "#given\n",
+ "V_max = 4.#maximum voltage in volts\n",
+ "V_min = 1.#minimum voltage in volts\n",
+ "\n",
+ "#calculation\n",
+ "m = (V_max - V_min)/(V_max + V_min) ;#formula for modulation index\n",
+ "m1 = m*100.#percentage modultion index\n",
+ "\n",
+ "#result\n",
+ "print \"Percentage modulation index =\",round(m1,2),\"percent\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "EXAMPLE 2.9(PAGENO 57)\n",
+ "Percentage modulation index = 60.0 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10 - pg 57"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier current and total modulation index\n",
+ "import math\n",
+ "#given\n",
+ "m1 = .4#modulation index\n",
+ "I_t1 = 11.#initial antenna current in ampers\n",
+ "I_t2 = 12.#final antenna current in ampers\n",
+ "\n",
+ "#calculations\n",
+ "I_c = (I_t1/(1+(m1**2/2))**.5);# formula for carrier current in ampers\n",
+ "m_t = math.sqrt(2*((I_t2/I_c)**2 -1));#total modulation index\n",
+ "m2 = math.sqrt(m_t**2 - m1**2);#modulation index to the second wave\n",
+ "m3 = m2*100;#percentage modulation index to the second wave\n",
+ "\n",
+ "#results\n",
+ "print \" Carrier current =\",round(I_c,2),\"A\"\n",
+ "print\"Total modulation index =\",round(m_t,4)\n",
+ "print \"Percentage modulation index of second wave=\",round(m3,2),\" percent\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Carrier current = 10.58 A\n",
+ "Total modulation index = 0.7554\n",
+ "Percentage modulation index of second wave= 64.08 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11 - pg 58"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index and new transmitted power\n",
+ "import math\n",
+ "from math import sqrt\n",
+ "#given\n",
+ "P_c = 10.*10**3#carrier power in watts\n",
+ "P_t = 12.*10**3#total power in watts\n",
+ "m_2 = .5#modulation index of second wave\n",
+ "\n",
+ "#calculations\n",
+ "m_1 = sqrt(2*((P_t/P_c)-1));#modulation index of first wave\n",
+ "m_t = sqrt(m_1**2 +m_2**2);#total modulation index\n",
+ "P_t1 = P_c*(1+(m_t**2/2))/1000.#total new transmitted power\n",
+ "\n",
+ "#results\n",
+ "print \"Modulation index of first wave =\", round(m_1,4)\n",
+ "print \"Total modulation index = \",round(m_t,1)\n",
+ "print \"total new transmitted power =\",round(P_t1,1),\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Modulation index of first wave = 0.6325\n",
+ "Total modulation index = 0.8\n",
+ "total new transmitted power = 13.3 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12 - pg 60"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index and total radiated power\n",
+ "import math\n",
+ "from math import sqrt\n",
+ "#given\n",
+ "P_t = 10.125*10**3#modulated or total power in watts\n",
+ "P_c = 9*10**3#unmodulated of carrier power\n",
+ "m_2 = .4#modulation index of second wave\n",
+ "\n",
+ "#calculations\n",
+ "m_1 = sqrt(2*((P_t/P_c) - 1))#modulation index of first wave\n",
+ "m_a = m_1*100#percentage modulation index of first wave\n",
+ "m_t = sqrt(m_1**2 + m_2**2)#total modulation index\n",
+ "P_t1 = P_c*(1+(m_t**2/2))#total radiated power\n",
+ "\n",
+ "#results\n",
+ "print \"i.a.Modulation index of first wave = \",round(m_1,4)\n",
+ "print \" b.Percentage modulation index of first wave =\",round(m_a,2),\" percent\"\n",
+ "print \"ii.Total radiated power =\",round(P_t1,2)/1000.,\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.a.Modulation index of first wave = 0.5\n",
+ " b.Percentage modulation index of first wave = 50.0 percent\n",
+ "ii.Total radiated power = 10.845 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 13 - pg 90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the percentage power saving for both signals\n",
+ "#given\n",
+ "m1 = 1.#modulation index of first signal\n",
+ "m2 = .5#modulation index of second signal\n",
+ "#let\n",
+ "P_c = 1.#carrier power in watts \n",
+ "\n",
+ "#calculations\n",
+ "P_1= P_c*(1+(m1**2/2b))#total power of first signal\n",
+ "P_2 = P_c*(1+(m2**2/2))#total power of second signal\n",
+ "P_a = (P_c*100)/(P_1)#percentage power saving for first signal\n",
+ "P_b = (P_c*100)/(P_2)#percentage power saving for second signal\n",
+ "\n",
+ "#results\n",
+ "print \"i.Percentage power saving for first signal=\",round(P_a,2),\" percent\"\n",
+ "print \"ii.Percentage power saving for second signal=\",round(P_b,2),\"percent\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Percentage power saving for first signal= 66.67 percent\n",
+ "ii.Percentage power saving for second signal= 88.89 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15 - pg 98"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the percentage power saving for both signals\n",
+ "#given\n",
+ "m1 = 1.#modulation index of first signal\n",
+ "m2 = .5#modulation index of second signal\n",
+ "#let\n",
+ "P_c = 1.#carrier power in watts \n",
+ "\n",
+ "#calculations\n",
+ "P_cssb1 = P_c*(1+(m1**2/4))#power in carrier plus power in one sideband for first signal\n",
+ "P_cssb2 = P_c*(1+(m2**2/4))#power in carrier plus power in one sideband for second signal\n",
+ "P_1= P_c*(1+(m1**2/2))#total power of first signal\n",
+ "P_2 = P_c*(1+(m2**2/2))#total power of second signal\n",
+ "P_a = (P_cssb1*100)/(P_1)#percentage power saving for first signal\n",
+ "P_b = (P_cssb2*100)/(P_2)#percentage power saving for second signal\n",
+ "\n",
+ "#results\n",
+ "print \"i.Percentage power saving for first signal=\",round(P_a,2),\" percent\"\n",
+ "print \"ii.Percentage power saving for second signal=\",round(P_b,2),\"percent\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Percentage power saving for first signal= 83.33 percent\n",
+ "ii.Percentage power saving for second signal= 94.44 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16 - pg 109"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the power content of the carrier in upper and lower sidebands\n",
+ "#given\n",
+ "P_ssb = 10*10**3#power in ssb transmission in watts\n",
+ "P_t = P_ssb# total power in watts\n",
+ "m_a = .8#modulation index\n",
+ "\n",
+ "#calculations\n",
+ "P_c = (P_t/(1+(m_a**2/4)+(m_a**2/4)))#carrier power in watts\n",
+ "P_SB = P_t - P_c#power in sidebands\n",
+ "P_usb = P_SB/2.#power in upper sideband\n",
+ "P_lsb =P_usb#power in upper sideband\n",
+ "\n",
+ "#results\n",
+ "print \"i.Power content of the carrier =\",round(P_c,2),\"W\"\n",
+ "print \"ii.a.Power content in upper sideband =\",round(P_usb),\"W\"\n",
+ "print \" b.Power content in lower sideband =\",round(P_lsb),\"W\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Power content of the carrier = 7575.76 W\n",
+ "ii.a.Power content in upper sideband = 1212.0 W\n",
+ " b.Power content in lower sideband = 1212.0 W\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 17 - pg 109"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index\n",
+ "#given from the figure\n",
+ "P_maxpp = 2*80.#maximum peak to peak power in watts\n",
+ "P_minpp = 2*20.#minimum peak to peak power in watts\n",
+ "\n",
+ "#calcualtions\n",
+ "m_a = (P_maxpp - P_minpp)/(P_maxpp + P_minpp)#modultaion index\n",
+ "M = m_a*100#percentage modulation index\n",
+ "\n",
+ "#results\n",
+ "print \"i.Modulation index = \",m_a\n",
+ "print \"ii.Percentage modulation index =\",round(M,2),\" percent\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Modulation index = 0.6\n",
+ "ii.Percentage modulation index = 60.0 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 18 - pg 110"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index\n",
+ "#given from the figure\n",
+ "P_maxpp = 2*50.#maximum peak to peak power in watts\n",
+ "P_minpp = 2*15.#minimum peak to peak power in watts\n",
+ "\n",
+ "#calculations\n",
+ "m_a = (P_maxpp - P_minpp)/(P_maxpp + P_minpp)#modultaion index\n",
+ "M = m_a*100#percentage modulation index\n",
+ "\n",
+ "#results\n",
+ "print \"i.Modulation index = \",round(m_a,3)\n",
+ "print \"ii.Percentage modulation index =\",round(M,1),\"percent\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Modulation index = 0.538\n",
+ "ii.Percentage modulation index = 53.8 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21 - pg 111"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier power,transmission efficiency and carrier amplitude\n",
+ "#given\n",
+ "import cmath\n",
+ "import math\n",
+ "p_t = 50*10**3#total power\n",
+ "m_a = .707#modulation index\n",
+ "z = 50+0*1j;#load\n",
+ "\n",
+ "#calculations\n",
+ "\n",
+ "#first case\n",
+ "p_x = .5*(m_a)**2;\n",
+ "p_c = p_t/(1+p_x)#carrier power\n",
+ "\n",
+ "#second case\n",
+ "n = ((p_c*p_x)/(p_c+(p_c*p_x)))*100;#transmission efficiency\n",
+ "\n",
+ "#third case\n",
+ "a_c = cmath.sqrt(2*z*p_c);#peak carrier amplitude \n",
+ "#results\n",
+ "print \"i. Carrier Power = \",round(p_c/1000.,0),\" kW\"\n",
+ "print \"ii. Percentage Transmission efficiency =\",round(n,2),\"percent\"\n",
+ "print \"iii. Carrier amplitude =\",round(abs(a_c),0),\" V\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i. Carrier Power = 40.0 kW\n",
+ "ii. Percentage Transmission efficiency = 20.0 percent\n",
+ "iii. Carrier amplitude = 2000.0 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 22 - pg 112"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the efficiency for ma=0.5 and for ma=1\n",
+ "#given\n",
+ "ma1=0.5\n",
+ "ma2=1.\n",
+ "\n",
+ "#calculations\n",
+ "eta1=ma1**2 /(ma1**2 +2) *100.\n",
+ "eta2= ma2**2 /(ma2**2 +2) *100.\n",
+ "\n",
+ "#results\n",
+ "print \"In case 1, efficiency = \",round(eta1,1),\"percent\"\n",
+ "print \"In case 2, efficiency = \",round(eta2,1),\"percent\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "In case 1, efficiency = 11.1 percent\n",
+ "In case 2, efficiency = 33.3 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 29 - pg 118"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation depth\n",
+ "#given\n",
+ "k = 2*10**-3#constants in amperes/square volts\n",
+ "k_1 = 0.2*10**-3#constant in amperes/square volts\n",
+ "print \"we know that V_i(t) = cos(w_c*t) + .5*cos(w_m*t)\"\n",
+ "print \"given i_0 = 10 + k*V_i + k_1*V_i**2 \"\n",
+ "print \"therefore i_0 = 10 + 2*10**-3*[cos(w_c*t) + .5*cos(w_m*t)] + 2*10**-3*[cos(w_c*t) + .5*cos(w_m*t)]\"\n",
+ "print \"i_0 = 2*10**-3*cos(w_c*t) + ((.2*10**-3)/.5)*.5*cos(w_c*t)*cos(w_m*t)\"\n",
+ "#Now the modulation depth will be\n",
+ "m = (.2*10**-3)/.5;\n",
+ "\n",
+ "#result\n",
+ "print \"Modulation depth = \",m\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "we know that V_i(t) = cos(w_c*t) + .5*cos(w_m*t)\n",
+ "given i_0 = 10 + k*V_i + k_1*V_i**2 \n",
+ "therefore i_0 = 10 + 2*10**-3*[cos(w_c*t) + .5*cos(w_m*t)] + 2*10**-3*[cos(w_c*t) + .5*cos(w_m*t)]\n",
+ "i_0 = 2*10**-3*cos(w_c*t) + ((.2*10**-3)/.5)*.5*cos(w_c*t)*cos(w_m*t)\n",
+ "Modulation depth = 0.0004\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 31 - pg 119"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the power saving in both cases\n",
+ "#given\n",
+ "#percentage modulation for first case\n",
+ "Pm_1 = 100.\n",
+ "#percentage modulation for second case\n",
+ "Pm_2 = 50.\n",
+ "m_1 = 1.#modulation index for first case\n",
+ "m_2 = .5#modulation index for second case\n",
+ "P_c = 1.#let carrier power be one\n",
+ "\n",
+ "#calcualations\n",
+ "\n",
+ "#first case\n",
+ "P_t1 = P_c*(1+(m_1**2/2.))#total power\n",
+ "P_sb1 = P_c*(m_1**2/4.)#power in one side band\n",
+ "P_s1 = ((P_t1-P_sb1)/P_t1)*100.#power saving\n",
+ "\n",
+ "#second case\n",
+ "P_t2 = P_c*(1+(m_2**2/2))#total power\n",
+ "P_sb2 = P_c*(m_2**2/4)#power in one side band\n",
+ "P_s2 = ((P_t2-P_sb2)/P_t2)*100.#power saving\n",
+ "\n",
+ "#results\n",
+ "print \"i. Power saving with percentage modulation 100 =\",round(P_s1,1),\" percent \"\n",
+ "print \"ii. Power saving with percentage modulation 50 =\",round(P_s2,1),\" percent\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i. Power saving with percentage modulation 100 = 83.3 percent \n",
+ "ii. Power saving with percentage modulation 50 = 94.4 percent\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 32 - pg 119"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the minimum value of fc\n",
+ "import math\n",
+ "#given\n",
+ "#the product signal is given by\n",
+ "#v(t) = s(t) * cos(2*%pi*t +phi) = x(t) *cos(2*%pi*f_c*t)*cos(2*%pi*f_c*t +phi)\n",
+ "#v(t) = x(t) *(cos(4*%pi*f_c*t +phi) +cos(phi))/2 = (x(t)/2)*cos(4*%pi*f_c*t +phi)+(x(t)/2)*cos(phi)\n",
+ "#the low pass filter will reject the first term. The maximum allowable value of phase angle(phi) can be found as under:\n",
+ "print \"cos(phi_max) = ((x(t)/2)*cos(phi))/max((x(t)/2)*cos(phi))\"\n",
+ "phi_max = math.acos(.95)*180/math.pi;\n",
+ "print \"phi_max = \",round(phi_max,2)\n",
+ "print \"In order to recover x(t) from v(t) using filter method, it is essential that the lowest frequency contained in the first term of v(t) must be greater than the highest frequency contained in the second term,i.e,\"\n",
+ "print \"2f_c -10KHz > 10KHz\"\n",
+ "print \"f_c >10KHz\"\n",
+ "print \"Hence, the minimum value of f_c will be\"\n",
+ "print \"f_c = 10KHz\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "cos(phi_max) = ((x(t)/2)*cos(phi))/max((x(t)/2)*cos(phi))\n",
+ "phi_max = 18.19\n",
+ "In order to recover x(t) from v(t) using filter method, it is essential that the lowest frequency contained in the first term of v(t) must be greater than the highest frequency contained in the second term,i.e,\n",
+ "2f_c -10KHz > 10KHz\n",
+ "f_c >10KHz\n",
+ "Hence, the minimum value of f_c will be\n",
+ "f_c = 10KHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Analog_and_digital_communication_by_S_Sharma/Chapter3.ipynb b/Analog_and_digital_communication_by_S_Sharma/Chapter3.ipynb
new file mode 100755
index 00000000..ee0835a7
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/Chapter3.ipynb
@@ -0,0 +1,168 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:2eb66c2913a0d4bb02308475470810282a4ee35c1698f96bcf0467035d4d37b5"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 3 - Radio Transmitters"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - pg 132"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the total radiated power\n",
+ "#given\n",
+ "Pm = 85.#percentage modulation\n",
+ "m = .85#modulation index\n",
+ "P_c = 50*10**3#carrier power in watts\n",
+ "\n",
+ "#calculation\n",
+ "P_t = P_c*(1+(m**2/2));#total radiated power \n",
+ " \n",
+ "#result\n",
+ "print \"Total radiated power =\",round(P_t/1000.,2),\"kW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total radiated power = 68.06 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - pg 138"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier frequencies\n",
+ "#given from the figure\n",
+ "f = 20#frequency in hertz\n",
+ "#At point 1 from fig\n",
+ "f_c1 = 2*13.5#carrier frequency\n",
+ "deltaf1 = 2*8.5*10**-3#change in frequency\n",
+ "\n",
+ "#calculations\n",
+ "f_max1 = f_c1 + deltaf1#maximum frequency at point 1 in fig\n",
+ "f_min1 = f_c1 - deltaf1#maximum frequency at point 1 in fig\n",
+ "f_d1 = f_max1 - f_c1;#frequency deviation at point 1 in fig\n",
+ "f_d2 = f_c1 - f_min1;#frequency deviation at point 1 in fig\n",
+ "#At point 2 from fig\n",
+ "f_c2 = 3*f_c1#carrier frequency\n",
+ "deltaf2 = 3*deltaf1#change in frequency\n",
+ "f_max2 = f_c2 + deltaf2#maximum frequency at point 2 in fig\n",
+ "f_min2 = f_c2 - deltaf2#minimum frequency at point 2 in fig\n",
+ "f_d3 = f_max2 - f_c2;#frequency deviation at point 2 in fig\n",
+ "f_d4 = f_c2 - f_min2;#frequency deviation at point 2 in fig\n",
+ "#At point 3 in fig\n",
+ "f_c3 = f_c2 + f;#carrier frequency at point 3 in fig\n",
+ "f_max3 = f_max2 + f#maximum frequency at point 3 in fig\n",
+ "f_min3 = f_min2+ f#minimum frequency at point 3 in fig\n",
+ "f_d5 = f_max3 - f_c3;#frequency deviation at the last point\n",
+ "f_d6 = f_c3 - f_min3 ;#frequency deviation at the last point\n",
+ "\n",
+ "#results\n",
+ "print \"i.a Carrier frequency at point 1 in fig = \",f_c1,\"MHz\"\n",
+ "print \" b Frequency deviation (kHz) = \",f_d1*1000.\n",
+ "print \" c Frequency deviation (kHz) = \",f_d2*1000.\n",
+ "print \"ii.a Carrier frequency at point 2 in fig (MHz) = \",f_c2\n",
+ "print \" b Frequency deviation (kHz) = \",f_d3*1000.\n",
+ "print \" c Frequency deviation (kHz) = \",f_d4*1000.\n",
+ "print \"ii.a Carrier frequency at point 3 in fig (MHz) = \",f_c3\n",
+ "print \" b Frequency deviation (kHz) = \",f_d5*1000.\n",
+ "print \" c Frequency deviation (kHz) = \",f_d6*1000.\n",
+ "print \"Thus, in mixer, frequency deviation is not altered but only carrier frequency is increased\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.a Carrier frequency at point 1 in fig = 27.0 MHz\n",
+ " b Frequency deviation (kHz) = 17.0\n",
+ " c Frequency deviation (kHz) = 17.0\n",
+ "ii.a Carrier frequency at point 2 in fig (MHz) = 81.0\n",
+ " b Frequency deviation (kHz) = 51.0\n",
+ " c Frequency deviation (kHz) = 51.0\n",
+ "ii.a Carrier frequency at point 3 in fig (MHz) = 101.0\n",
+ " b Frequency deviation (kHz) = 51.0\n",
+ " c Frequency deviation (kHz) = 51.0\n",
+ "Thus, in mixer, frequency deviation is not altered but only carrier frequency is increased\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - pg 138"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the appropriate multiplier values\n",
+ "print \"\\tInput frequency deviation is 10Khz, while the output frequency deviation \\nrequired is 60KHz. Thus, a frequency multiplication of 6*3*2 is required.\"\n",
+ "print \"\\tThe frequency multiplication of 6 will give the carrier frequency of\\n9*6 = 54MHz only. Hence we have to use heterodyning. The two inputs to the \\nmixer are the carrier frequency pf 54MHz and oscillator frequency. Assuming \\nthat at the output of the mixer addition of imput frequencies is selected the \\nrequired oscillator frequency, to have the final carrier output frequency of \\n106MHz, comes out to be 52MHz.[52+54 =106]. \"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\tInput frequency deviation is 10Khz, while the output frequency deviation \n",
+ "required is 60KHz. Thus, a frequency multiplication of 6*3*2 is required.\n",
+ "\tThe frequency multiplication of 6 will give the carrier frequency of\n",
+ "9*6 = 54MHz only. Hence we have to use heterodyning. The two inputs to the \n",
+ "mixer are the carrier frequency pf 54MHz and oscillator frequency. Assuming \n",
+ "that at the output of the mixer addition of imput frequencies is selected the \n",
+ "required oscillator frequency, to have the final carrier output frequency of \n",
+ "106MHz, comes out to be 52MHz.[52+54 =106]. \n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Analog_and_digital_communication_by_S_Sharma/Chapter4.ipynb b/Analog_and_digital_communication_by_S_Sharma/Chapter4.ipynb
new file mode 100755
index 00000000..de531ca7
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/Chapter4.ipynb
@@ -0,0 +1,367 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:caca8dab0d3857abcaf7d3628393a15e93a869b003e981e40fff14ea15639860"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4 - Radio receivers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - pg 150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the image frequency and rejection ratio in both cases\n",
+ "import math\n",
+ "from math import sqrt\n",
+ "#given data\n",
+ "Q = 100.#quality factor\n",
+ "f_i = 455.*10**3#intermediate frequency\n",
+ "\n",
+ "#calculations\n",
+ "#first case\n",
+ "f_s = 1000.*10**3#incoming frequecy of first case\n",
+ "f_si = f_s + 2*f_i#image frequency of first case\n",
+ "p = (f_si/f_s) - (f_s/f_si);\n",
+ "alpha = sqrt(1+(Q**2*p**2))#rejection ratio of first case\n",
+ "#second case\n",
+ "f_s1 = 25.*10**6#incoming frequecy of second case\n",
+ "f_si1 = f_s1+ 2*f_i#image frequency of second case\n",
+ "p1 = ((f_si1/f_s1) - (f_s1/f_si1)); \n",
+ "alpha1 = sqrt(1+(Q**2*p1**2))#rejection ratio of second case\n",
+ "\n",
+ "#results\n",
+ "print \"(i)a.Image frequency of first case (kHz)\",f_si/1000.\n",
+ "print \" b.Rejection ratio of first case = \",round(alpha,1)\n",
+ "print \" (ii)a.Image frequency of second case (MHz) = \",round(f_si1/10**6,2)\n",
+ "print \" b.Rejection ratio of second case = \",round(alpha1,2)\n",
+ "print \"Note: Their is mistake in textbook in the calculation of rejection ratio\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i)a.Image frequency of first case (kHz) 1910.0\n",
+ " b.Rejection ratio of first case = 138.6\n",
+ " (ii)a.Image frequency of second case (MHz) = 25.91\n",
+ " b.Rejection ratio of second case = 7.22\n",
+ "Note: Their is mistake in textbook in the calculation of rejection ratio\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - pg 150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the image frequency and rejection ratio in both cases\n",
+ "import math\n",
+ "from math import sqrt\n",
+ "#given data\n",
+ "Q = 90.\n",
+ "f_i = 455.*10**3#intermediate frequency\n",
+ "\n",
+ "#calculations\n",
+ "#first case\n",
+ "f_s = 950.*10**3#incoming frequency of first case\n",
+ "f_si = f_s + 2*f_i#image frequency of first case\n",
+ "p = (f_si/f_s) - (f_s/f_si);\n",
+ "alpha = sqrt(1+(Q**2*p**2))#rejection ratio of first case\n",
+ "#second case\n",
+ "f_s1 = 10.*10**6#incoming frequecy of second case\n",
+ "f_si1 = f_s1+ 2*f_i#image frequency of second case\n",
+ "p1 = ((f_si1/f_s1) - (f_s1/f_si1)); \n",
+ "alpha1 = sqrt(1+(Q**2*p1**2))#rejection ratio of second case\n",
+ "\n",
+ "#results\n",
+ "print \"(i)a.Image frequency of first case (kHz)\",f_si/1000.\n",
+ "print \" b.Rejection ratio of first case = \",round(alpha,1)\n",
+ "print \" (ii)a.Image frequency of second case (MHz) = \",round(f_si1/10**6,2)\n",
+ "print \" b.Rejection ratio of second case = \",round(alpha1,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i)a.Image frequency of first case (kHz) 1860.0\n",
+ " b.Rejection ratio of first case = 130.2\n",
+ " (ii)a.Image frequency of second case (MHz) = 10.91\n",
+ " b.Rejection ratio of second case = 15.73\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - pg 151"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the quality factor and new intermediate frequency\n",
+ "#given\n",
+ "import math\n",
+ "from math import sqrt\n",
+ "a1 = 130.5#rejection ratio\n",
+ "f_s = 10.*10**3#incoming frequency\n",
+ "print (\"from fig 4.8 from t/b we can write that\")\n",
+ "\n",
+ "#calculations\n",
+ "#first case\n",
+ "alpha = 130.5#from problem 4.2 of first case\n",
+ "alpha2 = 15.72#from problem 4.2 of second case\n",
+ "alpha1 = alpha/alpha2#rejection ratio ofgiven RF amplifer\n",
+ "p1 =.174#from problem 4.2 of second case\n",
+ "Q = (sqrt(alpha1**2 - 1)/p1)#quality factor\n",
+ "#second case\n",
+ "p2 = 1.45#from problem 4.2 of second case\n",
+ "f_si =1860.*10**3#from problem 4.2 of second case\n",
+ "f_i = 950.*10**3#incoming frequency\n",
+ "f_i1 = 10.*10**6#good image frequency\n",
+ "f_si1 = (f_si*f_i1)/f_i; #image frequency\n",
+ "f_i2 = (f_si1 - f_i1)/2#new intermediate frequency\n",
+ "\n",
+ "#results\n",
+ "print \"(i)Quality factor = \",round(Q,2)\n",
+ "print \"(ii)New intermediate frequency (MHz) = \",round(f_i2/10**6,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "from fig 4.8 from t/b we can write that\n",
+ "(i)Quality factor = 47.36\n",
+ "(ii)New intermediate frequency (MHz) = 4.789\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5 - pg 152"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the local oscillator frequency and image frequency rejection ratio\n",
+ "import math\n",
+ "from math import sqrt\n",
+ "#given\n",
+ "IF = 455.*10**3#intermediate frequency in hertz\n",
+ "f_s = 900.*10**3#signal frequency in hertz\n",
+ "Q = 80.#quality factor\n",
+ "\n",
+ "#calculations\n",
+ "f_0 = f_s + IF#local oscillator frequency\n",
+ "f_si = f_s + 2* IF#image frequency\n",
+ "p = (f_si/f_s)-(f_s/f_si)\n",
+ "a = sqrt(1+(Q*p)**2)#image frequency rejection ratio\n",
+ "\n",
+ "#results\n",
+ "print \"(i)Local oscillator frequency (kHz) = \",f_0/1000.\n",
+ "print \"(ii)Image frequency (kHz) = \",f_si/1000.\n",
+ "print \"(iii)Image frequency rejection ratio = \",a\n",
+ "print \"Note:Their is mistake in textbook in the calculation of image frequency\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i)Local oscillator frequency (kHz) = 1355.0\n",
+ "(ii)Image frequency (kHz) = 1810.0\n",
+ "(iii)Image frequency rejection ratio = 121.114011776\n",
+ "Note:Their is mistake in textbook in the calculation of image frequency\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6 - pg 153"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the image frequency, rejection ratio\n",
+ "import math\n",
+ "from math import sqrt\n",
+ "#given\n",
+ "Q = 125. #quality factor\n",
+ "\n",
+ "#calculations\n",
+ "#first case\n",
+ "IF1 = 465.*10**3#intermediate frequency\n",
+ "f_s1 = 1.*10**6#incoming frequency for first case in hertz\n",
+ "f_s2 = 30.*10**6#second incoming frequency for first case in hertz\n",
+ "f_si1 = f_s1 + 2*IF1#image frequency for incoming frequency 1MHz for first case\n",
+ "f_si2 = f_s2 + 2*IF1#image frequency for incoming frequency 30MHz for first case\n",
+ "p1 = (f_si1/f_s1)-(f_s1/f_si1);\n",
+ "p2 = (f_si2/f_s2)-(f_s2/f_si2);\n",
+ "alpha1 = sqrt(1+(Q*p1)**2);#rejection ratio at 1MHz incoming frequency\n",
+ "alpha2 = sqrt(1+(Q*p2)**2);#rejection ratio at 30MHz incoming frequency\n",
+ "#second case\n",
+ "f_s3 = 1.*10**6#incoming frequency for second case in hertz\n",
+ "f_si3 = (f_si1*f_s2)/f_s3#image frequency\n",
+ "IF2 = (f_si3-f_s2)/2.#intermediate frequency\n",
+ "\n",
+ "#results\n",
+ "print \"(i)a.Image frequency for 1MHz incoming frequency (kHz) = \",f_si1/1000.\n",
+ "print \" b.Rejection ratio for 1MHz incoming frequency = \",round(alpha1,2)\n",
+ "print \" c.Image frequency for 30MHz incoming frequency (MHz) = \",f_si2/10**6\n",
+ "print \" d.Rejection ratio for 30MHz incoming frequency =\",round(alpha2,2)\n",
+ "print \"(ii)intermediate frequency for second case (Hz) = \",round(IF2/10**6,1)\n",
+ "print 'The answers are a bit different from textbook due to rounding off error'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i)a.Image frequency for 1MHz incoming frequency (kHz) = 1930.0\n",
+ " b.Rejection ratio for 1MHz incoming frequency = 176.49\n",
+ " c.Image frequency for 30MHz incoming frequency (MHz) = 30.93\n",
+ " d.Rejection ratio for 30MHz incoming frequency = 7.7\n",
+ "(ii)intermediate frequency for second case (Hz) = 13.9\n",
+ "The answers are a bit different from textbook due to rounding off error\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7 - pg 173"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the range of local oscillator frequency and image frequency\n",
+ "#given\n",
+ "fs1=3 #MHz\n",
+ "fs2=30 #MHz\n",
+ "IF=40.525 #MHZ\n",
+ "#calculations\n",
+ "f01=fs1+IF\n",
+ "f02=fs2+IF\n",
+ "fsi1=fs1+2*IF\n",
+ "fsi2=fs2+2*IF\n",
+ "#results\n",
+ "print 'The range of local oscillator frequency is ',f01,'MHz to',f02,'MHz'\n",
+ "print 'The range of image frequency is ',fsi1,'MHz to',fsi2,'MHz'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The range of local oscillator frequency is 43.525 MHz to 70.525 MHz\n",
+ "The range of image frequency is 84.05 MHz to 111.05 MHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8 - pg 174"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Q factor of RF amplifier\n",
+ "#given\n",
+ "fr=1*10**6 #Hz\n",
+ "BW=10.*10**3 #Hz\n",
+ "#calculations\n",
+ "Q=fr/BW\n",
+ "#results\n",
+ "print 'Q factor = ',Q"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Q factor = 100.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Analog_and_digital_communication_by_S_Sharma/Chapter5.ipynb b/Analog_and_digital_communication_by_S_Sharma/Chapter5.ipynb
new file mode 100755
index 00000000..4c327306
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/Chapter5.ipynb
@@ -0,0 +1,2125 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:c60efd914206d08126f8218f1e88325a1f0fb8a6ee971af39fa988bc26907f7c"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5 - Angle Modulation"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - pg 198"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier frequency, modulation frequency and max. frequency deviation, power dissipation\n",
+ "import math\n",
+ "#given\n",
+ "t=10 #sec\n",
+ "R = 10.#resistance in ohms\n",
+ "print \"v(t) = 12*cos(6*10**8*t + 5*sin(1250*t));\"\n",
+ "print \"v(t) = A*cos(w_c*t + m_f*sin(w_m*t))\"\n",
+ "#by comparing with standard \n",
+ "A = 12. #amplitude voltage in volts\n",
+ "w_c= 6*10**8 #angular carrier frequency in rad/sec\n",
+ "w_m = 1250. #angular modulating frequency in rad/sec\n",
+ "m_f = 5. #modulation index\n",
+ "\n",
+ "#calculations\n",
+ "f_c = w_c/(2*math.pi)#carrier frequency\n",
+ "f_m = w_m/(2*math.pi)#modulating frequency\n",
+ "deltaf = m_f*f_m#maximum deviation\n",
+ "V_rms = (A/math.sqrt(2))**2#rms volatage\n",
+ "P = V_rms/R#power dissipatted\n",
+ "\n",
+ "#results\n",
+ "print \" i. Carrier frequency (MHz) = \",round(f_c/10**6,1)\n",
+ "print \"ii. Modulation frequency (Hz) = \",round(f_m,0)\n",
+ "print \"iii. Modulation index = \",m_f\n",
+ "print \"iv.Maximum frequency deviation (Hz) = \", round(deltaf,0)\n",
+ "print \"v.Power dissipated (W) = \",P\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "v(t) = 12*cos(6*10**8*t + 5*sin(1250*t));\n",
+ "v(t) = A*cos(w_c*t + m_f*sin(w_m*t))\n",
+ " i. Carrier frequency (MHz) = 95.5\n",
+ "ii. Modulation frequency (Hz) = 199.0\n",
+ "iii. Modulation index = 5.0\n",
+ "iv.Maximum frequency deviation (Hz) = 995.0\n",
+ "v.Power dissipated (W) = 7.2\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - pg 199"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier frequency, highest and lowest frequencies and modulating index\n",
+ "\n",
+ "#given\n",
+ "f_c = 107.6*10**6#carrier frequency\n",
+ "f_m = 7.*10**3#modulating frequency\n",
+ "deltaf = 50.*10**3#frequency deviation\n",
+ "\n",
+ "#calculations\n",
+ "cs = 2*deltaf#carrier swing\n",
+ "f_H = f_c + deltaf#highest frequency \n",
+ "f_L = f_c - deltaf#lowest frequency \n",
+ "m_f = deltaf/f_m#modulating index\n",
+ "\n",
+ "#results\n",
+ "print \"i.Carrier frequency (kHz) = \",cs/1000.\n",
+ "print \"ii.a.Highest frequency attained by the modulating signal (MHz) = \",round(f_H/10**6,2)\n",
+ "print \" b.Lowest frequency attained by the modulating signal (MHz) = \",round(f_L/10**6,2)\n",
+ "print \"iii.modulating index of the FM wave = \",round(m_f,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Carrier frequency (kHz) = 100.0\n",
+ "ii.a.Highest frequency attained by the modulating signal (MHz) = 107.65\n",
+ " b.Lowest frequency attained by the modulating signal (MHz) = 107.55\n",
+ "iii.modulating index of the FM wave = 7.143\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - pg 199"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the frequency deviation,carrier swing and lower frequency\n",
+ "\n",
+ "#given\n",
+ "f_c = 105*10**6#carrier frequency \n",
+ "f_H = 105.007*10**6#highest frequency or upper frequency\n",
+ "#calculations\n",
+ "deltaf = f_H - f_c#frequency deviation\n",
+ "cs = 2*deltaf#carrier swing\n",
+ "f_L = f_c - deltaf#lower frequency\n",
+ "#results\n",
+ "print \"i.Frequency deviation (kHz) = \",deltaf/1000.\n",
+ "print \"ii.Carrier swing (kHz) = \",cs/1000.\n",
+ "print \"iii.Lower frequency reached by the modulated wave (MHz) = \",round(f_L/10**6,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Frequency deviation (kHz) = 7.0\n",
+ "ii.Carrier swing (kHz) = 14.0\n",
+ "iii.Lower frequency reached by the modulated wave (MHz) = 104.993\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4 - pg 200"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index\n",
+ "\n",
+ "#given\n",
+ "cs = 100.*10**3#carrier swing\n",
+ "f_m = 8.*10**3#modulating frequency\n",
+ "\n",
+ "#calculations\n",
+ "deltaf = cs/2.#frequency deviation\n",
+ "m_f = deltaf/f_m#modulation index\n",
+ "#results \n",
+ "print \"Modulation index = \",m_f\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Modulation index = 6.25\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5 - pg 200"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Percentage modulation index\n",
+ "\n",
+ "#given\n",
+ "deltaf = 20.*10**3#frequency deviation\n",
+ "deltaf_actual = deltaf#since deltaf_actual equals to deltaf\n",
+ "deltaf_max1 = 75.*10**3#maximum frequency deviation deltaf_max permittedfor the first case is 75KHz\n",
+ "deltaf_max2 = 25.*10**3#maximum frequency deviation deltaf_max permitted for the second case is 25KHz\n",
+ "\n",
+ "#calculations\n",
+ "M1 = (deltaf_actual/deltaf_max1)*100#persentage modulation index for first case\n",
+ "M2 = (deltaf_actual/deltaf_max2)*100#persentage modulation index for second case\n",
+ "\n",
+ "#results\n",
+ "print \"i.Percentage modulation index for first case (percent) = \",round(M1,2)\n",
+ "print \"ii.Percentage modulation index for second case (percent) = \",M2\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Percentage modulation index for first case (percent) = 26.67\n",
+ "ii.Percentage modulation index for second case (percent) = 80.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6 - pg 210"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the bandwidth of a commercial FM transmission\n",
+ "\n",
+ "#given\n",
+ "deltaf = 75.*10**3#frequency deviation\n",
+ "f_m = 15.*10**3#modulating frequency\n",
+ "\n",
+ "#calculation\n",
+ "BW = 2*(deltaf+f_m)#bandwidth \n",
+ "\n",
+ "#result\n",
+ "print \"Bandwidth of a commercial FM transmission (kHz) = \",BW/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Bandwidth of a commercial FM transmission (kHz) = 180.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7 - pg 210"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the bandwidth of a narrowband FM signal\n",
+ "\n",
+ "#given\n",
+ "f_m = 4.*10**3#modulation frequency\n",
+ "f_c = 125.*10**3#carrier frequency\n",
+ "\n",
+ "#claculation\n",
+ "BW = 2*f_m#bandwidth\n",
+ "\n",
+ "#result\n",
+ "print \"Bandwidth of a narrowband FM signal (kHz) = \",BW/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Bandwidth of a narrowband FM signal (kHz) = 8.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8 - pg 210"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the bandwidth of a signal under required conditions\n",
+ "\n",
+ "#given\n",
+ "deltaf1 = 75.*10**3#frequency deviation \n",
+ "f_m = 8.*10**3#modulation frequency\n",
+ "deltaf2 = 2*deltaf1#if modulation signal amplitude is doubled, the frequency deviation becomes double\n",
+ "\n",
+ "#calculation\n",
+ "BW1 = 2*(deltaf1 +f_m)#bandwidth\n",
+ "BW2 = 2*(deltaf2 +f_m)#new bandwidth\n",
+ "\n",
+ "#result\n",
+ "print \"Bandwidth of a signal when modulating signal amplitude is doubled (kHz) = \",BW2/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Bandwidth of a signal when modulating signal amplitude is doubled (kHz) = 316.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9 - pg 211"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index and bandwidth\n",
+ "\n",
+ "#given\n",
+ "f_m = 5.*10**3#modulating frequency\n",
+ "f_c = 50.*10**6#carrier frequency\n",
+ "deltaf = 20.*10**3#frequency deviation\n",
+ "\n",
+ "#calculations\n",
+ "m_f = deltaf/f_m#modulation index\n",
+ "BW = deltaf*3.8#referring to the Schwartz bandwidth curve \n",
+ "\n",
+ "#results \n",
+ "print \"i.Modulation index = \",m_f\n",
+ "print \"ii.Bandwidth of the FM signal (kHz) = \",BW/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Modulation index = 4.0\n",
+ "ii.Bandwidth of the FM signal (kHz) = 76.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10 - pg 212"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulating frequency\n",
+ "\n",
+ "#given\n",
+ "BW = 50.*10**3#bandwidth\n",
+ "deltaf = 10.*10**3#frequency deviation\n",
+ "\n",
+ "#calculation\n",
+ "x = BW/deltaf#variable\n",
+ "m_f = 2#by referring to the Schwartz bandwidth curve with 'x'\n",
+ "f_m = deltaf/m_f#modulating frequency\n",
+ "\n",
+ "#results\n",
+ "print \"Modulating frequency (kHz) = \",f_m/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Modulating frequency (kHz) = 5.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11 - pg 217"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index and bandwidth in all cases\n",
+ "print (\"EXAMPLE 5.11(PAGENO 217)\");\n",
+ "#given\n",
+ "#x(t) = 5*cos(2*%pi*15*10**3*t)\n",
+ "V_m = 5.#amplitude of voltage\n",
+ "f_m = 15.*10**3#modulation frequency\n",
+ "k_f = 15.*10**3#frequency sensitivity\n",
+ "k_p = 15.*10**3#phase sensitivity\n",
+ "\n",
+ "#calculations\n",
+ "#first case\n",
+ "#for FM system\n",
+ "delta_f1 = k_f * V_m;#frequency deviation for FM system\n",
+ "m_f1 = delta_f1/f_m; #modulation index in FM system\n",
+ "BW1 = 2*(delta_f1+f_m);#bandwidth for FM system\n",
+ "#for PM system\n",
+ "delta_f2 = k_f * V_m*f_m;#frequency deviation for PM system\n",
+ "BW2 = 2*(delta_f2 + f_m);#bandwidth for PM system\n",
+ "m_p1 = k_p * V_m#modulation index in PM system\n",
+ "\n",
+ "#second case\n",
+ "f_m1 = 5*10**3#modulating frequency for second case\n",
+ "#for FM system\n",
+ "delta_f3 = k_p * V_m;#frequency deviation for FM system\n",
+ "m_f2 = delta_f3/f_m1; #modulation index in FM system\n",
+ "BW3 = 2*(delta_f3+f_m1);#bandwidth for FM system\n",
+ "#for PM system\n",
+ "delta_f4 = k_p * V_m*f_m1;#frequency deviation for PM system\n",
+ "BW4 = 2*(delta_f4 + f_m1);#bandwidth for PM system\n",
+ "m_p2 = k_p * V_m#modulation index in PM system\n",
+ "\n",
+ "#results\n",
+ "print \"i.a.Modulation index of FM system for first case =\",m_f1\n",
+ "print \" b.Bandwidth of FM system for first case (kHz) = \",BW1/1000.\n",
+ "print \"ii.a.Modulation index of PM system for first case = \",m_p1\n",
+ "print \" b.Bandwidth of PM system for first case (MHz) = \",round(BW2/10**6,0)\n",
+ "print \"iii.a.Modulation index of FM system for second case = \",m_f2\n",
+ "print \" b.Bandwidth of FM system for second case (kHz) = \",BW3/1000.\n",
+ "print \"iv.a.Modulation index of PM system for second case (kHz) = \",m_p2/1000.\n",
+ "print \" b.Bandwidth of PM system for second case (MHz) = \",round(BW4/10**6,0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "EXAMPLE 5.11(PAGENO 217)\n",
+ "i.a.Modulation index of FM system for first case = 5.0\n",
+ " b.Bandwidth of FM system for first case (kHz) = 180.0\n",
+ "ii.a.Modulation index of PM system for first case = 75000.0\n",
+ " b.Bandwidth of PM system for first case (MHz) = 2250.0\n",
+ "iii.a.Modulation index of FM system for second case = 15.0\n",
+ " b.Bandwidth of FM system for second case (kHz) = 160.0\n",
+ "iv.a.Modulation index of PM system for second case (kHz) = 75.0\n",
+ " b.Bandwidth of PM system for second case (MHz) = 750.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12 - pg 219"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier frequency, modulating frequency and index, deviation and power\n",
+ "import math\n",
+ "#given\n",
+ "#given that v = 10*sin((5 * 10**8 *t) + 4*sin(1250*t))\n",
+ "#by comparing with standard eqn i.e v = V_c*sin((w_c * t) + m_f*sin(w_m*t)) we get\n",
+ "w_c = 5.*10**8#angular carrier frequency\n",
+ "w_m = 1250.#angular modulating frequency\n",
+ "m_f = 4. #modulating index\n",
+ "V_c = 10. #carrier voltage in volts\n",
+ "R = 5. #resistance in ohms\n",
+ "\n",
+ "#calculations\n",
+ "f_c = w_c/(2*math.pi)#carrier frequency\n",
+ "f_m = w_m/(2*math.pi)#modulating frequency\n",
+ "deltaf = m_f * f_m#maximum deviation\n",
+ "V_rms = (V_c/math.sqrt(2))**2#RMS value of FM wave\n",
+ "P = V_rms/R#power dissipated\n",
+ "\n",
+ "#results\n",
+ "print \"i.a.Carrier frequency (MHz) = \",round(f_c/10**6,2)\n",
+ "print \" b.Modulating frequency (Hz) = \",round(f_m,0)\n",
+ "print \"ii.a.Modulation index = \",m_f\n",
+ "print \" b.Maximum deviation (Hz) = \",round(deltaf,0)\n",
+ "print \"iii.Power dissipated in 5 ohms resistance (W) = \",P\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.a.Carrier frequency (MHz) = 79.58\n",
+ " b.Modulating frequency (Hz) = 199.0\n",
+ "ii.a.Modulation index = 4.0\n",
+ " b.Maximum deviation (Hz) = 796.0\n",
+ "iii.Power dissipated in 5 ohms resistance (W) = 10.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 13 - pg 220"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the frequency deviation for modulating voltage\n",
+ "\n",
+ "#given\n",
+ "f_m = 1.*10**3#modulating frequency\n",
+ "V_m = 2.#modulating voltage in volts\n",
+ "deltaf = 6.*10**3#frequency deviation\n",
+ "V_m1 = 4.#increased modulation voltage for first case\n",
+ "V_m2 = 8.#increased modulation voltage for second case\n",
+ "\n",
+ "#calculations\n",
+ "k_f = deltaf/V_m#proportion constant\n",
+ "#first case\n",
+ "deltaf1 = k_f*V_m1#frequency deviation for first case\n",
+ "#second case\n",
+ "deltaf2 = k_f*V_m2#frequency deviation for second case\n",
+ "\n",
+ "#results\n",
+ "print \"i.Frequency deviation for modulating voltage 4V (kHz) = \",deltaf1/1000.\n",
+ "print \"ii.Frequency deviation for modulating voltage 8V (kHz) = \",deltaf2/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Frequency deviation for modulating voltage 4V (kHz) = 12.0\n",
+ "ii.Frequency deviation for modulating voltage 8V (kHz) = 24.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14 - pg 220"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index\n",
+ "\n",
+ "#given\n",
+ "deltaf = 6.*10**3#frequency deviation from the question of EXAMPLE 5.13(PAGENO 220)\n",
+ "f_m = 1.*10**3#modulating frequency from the question of EXAMPLE 5.13(PAGENO 220)\n",
+ "deltaf1 = 12.*10**3#frequency deviation from the EXAMPLE 5.13(PAGENO 220) of first case\n",
+ "deltaf2 = 24.*10**3#frequency deviation from the EXAMPLE 5.13(PAGENO 220) of second case\n",
+ "f_m1 = f_m#modulating frequency from the EXAMPLE 5.13(PAGENO 220) of first case\n",
+ "f_m2 = 500.#modulating frequency from the EXAMPLE 5.13(PAGENO 220) ofsecond case\n",
+ "\n",
+ "#calculation\n",
+ "m_f = deltaf/f_m#modulation index for the initial conditions given in the problem 5.13\n",
+ "m_f1 = deltaf1/f_m1#modulation index for the first case\n",
+ "m_f2 = deltaf2/f_m2#modulation index for the second case\n",
+ "\n",
+ "#results\n",
+ "print \"a.Modulation index for initial conditions given in the problem 5.13 = \",m_f\n",
+ "print \"b.Modulation index for the first case = \",m_f1\n",
+ "print \"c.Modulation index for the second case = \",m_f2\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "a.Modulation index for initial conditions given in the problem 5.13 = 6.0\n",
+ "b.Modulation index for the first case = 12.0\n",
+ "c.Modulation index for the second case = 48.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15 - pg 220"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the bandwidth of FM signal\n",
+ "\n",
+ "#given\n",
+ "deltaf = 10.*10**3#frequency deviation\n",
+ "f_m = 1.*10**3#modulating frequency\n",
+ "\n",
+ "#calculations\n",
+ "BW = 2*(deltaf + f_m)#bandwidth of FM signal\n",
+ "BW_DSB = 2*f_m#bandwidth of DSB FC(AM)\n",
+ "\n",
+ "#results\n",
+ "print \"i.Bandwidth of FM signal (kHz) = \",BW/1000.\n",
+ "print \"ii.Bandwidth of DSB FC(AM) signal (kHz) = \",BW_DSB/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Bandwidth of FM signal (kHz) = 22.0\n",
+ "ii.Bandwidth of DSB FC(AM) signal (kHz) = 2.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16 - pg 221"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the wave equations\n",
+ "import math\n",
+ "#given\n",
+ "#first case\n",
+ "f_c1 = 20.*10**6#carrier frequency\n",
+ "f_m1 = 400.#modulation frequency\n",
+ "V_c = 5.#carrier voltage in volts\n",
+ "deltaf = 10.*10**3#frequency deviation\n",
+ "#second case\n",
+ "f_m2 = 2.*10**3#modulation frequency\n",
+ "\n",
+ "#calculations\n",
+ "w_c1 = 2 *math.pi *f_c1#angular carrier freqency\n",
+ "w_m1 = 2 *math.pi *f_m1#angular carrier freqency\n",
+ "m_f1 = deltaf/f_m1#modulation index for first case\n",
+ "m_f2 = deltaf/f_m2#modulation index for second case\n",
+ "\n",
+ "#results\n",
+ "#standard format of fm and pm equations are\n",
+ "#s(t) = V_c8sin(w_c*t + m_f*sin(w_m*t))\n",
+ "print \"(i)FM wave:s(t) =\",m_f2,\"*sin(1.25*10**8*t +\",m_f1,\"*sin(2513*t)\"\n",
+ "print \"(ii)PM wave:s(t) =\",m_f2,\"*sin(1.25*10**8*t +\",m_f1,\"*sin(2513*t)\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i)FM wave:s(t) = 5.0 *sin(1.25*10**8*t + 25.0 *sin(2513*t)\n",
+ "(ii)PM wave:s(t) = 5.0 *sin(1.25*10**8*t + 25.0 *sin(2513*t)\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 17 - pg 221"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier amplitude, maximum and minimum frequencies\n",
+ "\n",
+ "#given\n",
+ "V_m = 5.#modulating voltage\n",
+ "f_m = 200.*10**3#modulating frequency\n",
+ "V_c = 10.#carrier voltage\n",
+ "f_c = 100.*10**6#carrier frequency\n",
+ "delta_f = 2.*10**3#frequeny deviation in hertz per volt\n",
+ "\n",
+ "#calculations\n",
+ "m_a = delta_f/f_m#modulation index\n",
+ "print \"for m_a = .5 the approximate values of j coefficients are\"\n",
+ "print \"J_0 = .94 J_1 = .24 J_2 =.03\"\n",
+ "J_0 = .94\n",
+ "J_1 = .24\n",
+ "J_2 =.03\n",
+ "A_c = V_c*J_0;#carrier amplitude\n",
+ "A_1 = V_c*J_1;#amplitude of first pair of sideband\n",
+ "A_2 = V_c*J_2;#amplitude of second pair of sideband\n",
+ "f_1 = f_c + f_m#maximum frequency of first pair of sideband \n",
+ "f_1a = f_c - f_m#minimum frequency of first pair of sideband \n",
+ "f_2 = f_c + (2*f_m)#maximum frequency of second pair of sideband \n",
+ "f_2a = f_c - (2*f_m)#minimum frequency of second pair of sideband\n",
+ "\n",
+ "#results\n",
+ "print \"i.Carrier amplitude (V) = \",A_c\n",
+ "print \"ii.Amplitude of first pair of sideband (V) = \",A_1\n",
+ "print \"iii.Amplitude of second pair of sideband (V) = \",A_2\n",
+ "print \"iV.a.Maximum frequency of first pair of sideband (MHz) = \",round(f_1/10**6,2)\n",
+ "print \" .b.Minimum frequency of first pair of sideband (MHz) = \",round(f_1a/10**6,2)\n",
+ "print \"V.a.Maximum frequency of second pair of sideband (MHz) = \",round(f_2/10**6,2)\n",
+ "print \" .b.Minimum frequency of second pair of sideband (MHz) = \",round(f_2a/10**6,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "for m_a = .5 the approximate values of j coefficients are\n",
+ "J_0 = .94 J_1 = .24 J_2 =.03\n",
+ "i.Carrier amplitude (V) = 9.4\n",
+ "ii.Amplitude of first pair of sideband (V) = 2.4\n",
+ "iii.Amplitude of second pair of sideband (V) = 0.3\n",
+ "iV.a.Maximum frequency of first pair of sideband (MHz) = 100.2\n",
+ " .b.Minimum frequency of first pair of sideband (MHz) = 99.8\n",
+ "V.a.Maximum frequency of second pair of sideband (MHz) = 100.4\n",
+ " .b.Minimum frequency of second pair of sideband (MHz) = 99.6\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 18 - pg 222"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the maximum frequency deviation for first case and modulation index for second case\n",
+ "\n",
+ "#given\n",
+ "f_m1 = 400.#modulating frequency for first case\n",
+ "V_m1 = 2.4#modulating voltage for first case\n",
+ "f_m2 = 250.#modulating frequency for second case\n",
+ "V_m2 = 3.2#modulating voltage for second case\n",
+ "m_f1 = 60.#modulation index for first case\n",
+ "\n",
+ "#calculations\n",
+ "delta_f1 = m_f1*f_m1#maximum frequency deviation for first case\n",
+ "k = delta_f1/V_m1#constant\n",
+ "delta_f2 = k*V_m2#frequency deviation for second case\n",
+ "m_f2 = delta_f2/f_m2#modulation index for second case\n",
+ "\n",
+ "#results\n",
+ "print \"i.Maximum frequency deviation for first case (kHz) = \",round(delta_f1/1000.,0)\n",
+ "print \"ii.Modulation index for second case = \",m_f2\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Maximum frequency deviation for first case (kHz) = 24.0\n",
+ "ii.Modulation index for second case = 128.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 19 - pg 222"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index and bandwidth for both cases\n",
+ "\n",
+ "#given\n",
+ "f_m1 = 1.*10**3#modulating frequency for first case\n",
+ "f_m2 = 500.#modulating frequency for second case\n",
+ "V_m1 = 2.#modulating voltage for first case\n",
+ "V_m2 = 8.#modulating volatge for second case\n",
+ "delta_f1 = 4.*10**3#frequency deviation for first case\n",
+ "\n",
+ "#calculations \n",
+ "k = delta_f1/V_m1#constant\n",
+ "delta_f2 = k*V_m2#frequency deviation for second case\n",
+ "m_f1 = delta_f1/f_m1#modulation index for first case\n",
+ "m_f2 = delta_f2/f_m2#modulation index for second case\n",
+ "BW1 = 2*(delta_f1 + f_m1)#bandwidth for first case\n",
+ "BW2 = 2*(delta_f2 + f_m2)#bandwidth for second case\n",
+ " \n",
+ "#results\n",
+ "print \"i.a.Modulation index for first case = \",m_f1\n",
+ "print \" b.Bandwidth for first case (kHz) = \",BW1/1000.\n",
+ "print \"ii.a.Modulation index for second case = \",m_f2\n",
+ "print \" b .Bandwidth for second case (kHz) = \",BW2/1000.\n",
+ "print \"Note: Their is error in textbook in the calculation of second case bandwidth \"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.a.Modulation index for first case = 4.0\n",
+ " b.Bandwidth for first case (kHz) = 10.0\n",
+ "ii.a.Modulation index for second case = 32.0\n",
+ " b .Bandwidth for second case (kHz) = 33.0\n",
+ "Note: Their is error in textbook in the calculation of second case bandwidth \n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 20 - pg 232"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the capacitive reactance\n",
+ "#given\n",
+ "g_m = 10*10**-3#transconductance \n",
+ "n = 8\n",
+ "f= 5*10**6#operating frequency\n",
+ "\n",
+ "#calculation\n",
+ "X_Ceq = n/g_m#capacitive reactance\n",
+ "\n",
+ "#result\n",
+ "print \"Capacitive reactance (ohms) = \",X_Ceq\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Capacitive reactance (ohms) = 800.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21 - pg 233"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier frequency and deviation, modulation index\n",
+ "\n",
+ "#given data from block diagram\n",
+ "f_c = 10.*10**6#carrier frequency \n",
+ "delta_f = 10.*10**3#frequency deviation\n",
+ "m_f = 5.#modulation index\n",
+ "\n",
+ "#calculations\n",
+ "#first stage\n",
+ "f_cA = 3 * f_c#carrier frequency at point A\n",
+ "delta_fA = 3 * delta_f#frequency deviation at point A\n",
+ "m_fA = 3 * m_f#modulation index at point A\n",
+ "f_maxA = f_cA + delta_fA#maximum frequency at point A\n",
+ "f_minA = f_cA - delta_fA#minimum frequency at point A\n",
+ "#second stage\n",
+ "f_cB = f_cA + f_c#carrier frequency at point B\n",
+ "f_maxB = f_maxA +f_c#maximum frequency at point B\n",
+ "f_minB = f_minA + f_c#minimum frequency at point B\n",
+ "delta_fB = f_maxB - f_cB#frequency deviation at point B\n",
+ "#their will no change in modulation index \n",
+ "\n",
+ "#results\n",
+ "print \"i.a.Carrier frequency at point A (MHz) = \",f_cA/10**6\n",
+ "print \" b.Frequency deviation at point A (kHz) = \",delta_fA/10**3\n",
+ "print \" c.Modulation index at point A = \",m_fA\n",
+ "print \" d.Maximum frequency at point A (MHz) = \",round(f_maxA/10**6,3)\n",
+ "print \" e.Minimum frequency at point A (MHz) = \",round(f_minA/10**6,3)\n",
+ "print \"ii.a.Carrier frequency at point B (MHz) = \",f_cB/10**6\n",
+ "print \" b.Frequency deviation at point B (kHz) = \",delta_fB/10**3\n",
+ "print \" c.Modulation index at point B = \",m_fA\n",
+ "print \" d.Maximum frequency at point B (MHz) = \",round(f_maxB/10**6,3)\n",
+ "print \" e.Minimum frequency at point B (MHz) = \",round(f_minB/10**6,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.a.Carrier frequency at point A (MHz) = 30.0\n",
+ " b.Frequency deviation at point A (kHz) = 30.0\n",
+ " c.Modulation index at point A = 15.0\n",
+ " d.Maximum frequency at point A (MHz) = 30.03\n",
+ " e.Minimum frequency at point A (MHz) = 29.97\n",
+ "ii.a.Carrier frequency at point B (MHz) = 40.0\n",
+ " b.Frequency deviation at point B (kHz) = 30.0\n",
+ " c.Modulation index at point B = 15.0\n",
+ " d.Maximum frequency at point B (MHz) = 40.03\n",
+ " e.Minimum frequency at point B (MHz) = 39.97\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 22 - pg 251"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index\n",
+ "#given\n",
+ "#first case\n",
+ "#The maximum deviation in commerical FM is given as\n",
+ "delta_f1 = 75.*10**3#frequency deviation in commerical FM\n",
+ "f_m1 = 30.#maximum modulating frequency\n",
+ "f_m2 = 15.*10**3#minimum modulating frequency\n",
+ "#second case\n",
+ "delta_f2 = 10.*10**3#frequency deviation for narrowband FM\n",
+ "f_m3 = 100.#maximum modulating frequency\n",
+ "f_m4 = 3.*10**3#minimum modulating frequency \n",
+ " \n",
+ "#calculations\n",
+ "#first case\n",
+ "m_f1 = delta_f1/f_m1#modulation index for maximum modulating frequency\n",
+ "m_f2 = delta_f1/f_m2#modulation index for minimum modulating frequency \n",
+ "#second case\n",
+ "m_f3 = delta_f2/f_m3#modulation index for maximum modulating frequency \n",
+ "m_f4 = delta_f2/f_m4#modulation index for minimum modulating frequency \n",
+ "\n",
+ "#results\n",
+ "print \" i.a.modulation index for maximum modulating frequency of commercial FM = \",m_f1\n",
+ "print \" b.modulation index for minimum modulating frequency of commercial FM = \",m_f2\n",
+ "print \"ii.a.modulation index for maximum modulating frequency of narrowband FM = \",m_f3\n",
+ "print \" b.modulation index for minimum modulating frequency of commercial FM = \",round(m_f4,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " i.a.modulation index for maximum modulating frequency of commercial FM = 2500.0\n",
+ " b.modulation index for minimum modulating frequency of commercial FM = 5.0\n",
+ "ii.a.modulation index for maximum modulating frequency of narrowband FM = 100.0\n",
+ " b.modulation index for minimum modulating frequency of commercial FM = 3.33\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 23 - pg 251"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index\n",
+ "\n",
+ "#given\n",
+ "print ('modulated carrier waveform is given by s(t) = A*sin((2*pi*f_c*t)+m_f*sin(2*pi*f_m*t))');\n",
+ "f_c = 100.*10**6#carrier frequency in hertz\n",
+ "delta_f = 75.*10**3#frequency deviation in hertz\n",
+ "f_m = 2.*10**3#modulating frequency\n",
+ "A = 5#peak voltage of carrier wave\n",
+ "\n",
+ "#calculation\n",
+ "m_f = delta_f/f_m;#modulation index\n",
+ "\n",
+ "#result\n",
+ "print \" Modulation index = \",m_f\n",
+ "print (\"Equation for modulated carrier waveform s(t) = 5*sin((2*pi*100*10**6*t)+37.5*sin(2*pi*2*10**3*t))\");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "modulated carrier waveform is given by s(t) = A*sin((2*pi*f_c*t)+m_f*sin(2*pi*f_m*t))\n",
+ " Modulation index = 37.5\n",
+ "Equation for modulated carrier waveform s(t) = 5*sin((2*pi*100*10**6*t)+37.5*sin(2*pi*2*10**3*t))\n"
+ ]
+ }
+ ],
+ "prompt_number": 38
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 24 - pg 252"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the frequency sensitivity and modulation index\n",
+ "\n",
+ "#given\n",
+ "#we know that s(t) = A*cos((2*%pi*f_c*t) + m_f*sin(2*%pi*f_m*t ))\n",
+ "f_c = 1.*10**6#modulation frequency\n",
+ "A = 3.#carrier amplitude in volts\n",
+ "#first case\n",
+ "A_m = 1.#modulating amplitude in volts for first case\n",
+ "delta_f = 1.*10**3#frequency deviation\n",
+ "f_m1 = 1.#modulating frequencyof first case\n",
+ "#second case\n",
+ "f_m2 = 2.*10**3#modulating frequency for second case\n",
+ "A_m2 = 5.#modulating amplitude for second case\n",
+ "\n",
+ "#calculations\n",
+ "k_f = delta_f/f_m1#frequency sensitivity in hertz per volt\n",
+ "m_f = (delta_f*A_m2)/f_m2#modulating frequency\n",
+ "#desired FM signal can be expressed by s(t) = A*cos((2*%pi*f_c*t) + m_f*sin(2*%pi*f_m*t ))\n",
+ "#results\n",
+ "#standard FM signal expression is as follows\n",
+ "#s(t) = A*cos(2*%pi*f_c*t + m_f * sin(2*%pi*f_m*t))\n",
+ "print \"Frequency sensitivity k_f (Hz/volt)= \",k_f\n",
+ "print \"Modulation index m_f =\",m_f\n",
+ "\n",
+ "print (\"s(t)=3*cos(2*pi*10**6*t + 2.5*sin(2*pi*2*10**3*t)\");\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Frequency sensitivity k_f (Hz/volt)= 1000.0\n",
+ "Modulation index m_f = 2.5\n",
+ "s(t)=3*cos(2*pi*10**6*t + 2.5*sin(2*pi*2*10**3*t)\n"
+ ]
+ }
+ ],
+ "prompt_number": 40
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 29 - pg 256"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the bandwidth and percentage of under estimation\n",
+ "\n",
+ "#given\n",
+ "delta_f = 75.*10**3#frequency deviation\n",
+ "f_m = 15.*10**3#modulating frequency\n",
+ "\n",
+ "#calculations\n",
+ "D = delta_f/f_m#deviation ratio\n",
+ "BW1 = 2*delta_f*(1+(1/D))#bandwidth of FM signal\n",
+ "#using universal curve, replacing m_f by D,we get\n",
+ "BW2 = 3.2*delta_f#for D = 5=3.2*75*10**3\n",
+ "BW = (BW2-BW1)*100/BW2#percentage of under estimation of bandwidth by using carson's rule\n",
+ "\n",
+ "#results\n",
+ "print \"i.Bandwidth of FM signal (kHz) = \",BW1/1000.\n",
+ "print \"ii.Bandwidth obtained by replacing m_f by D (kHz) = \",BW2/1000.\n",
+ "print \"iii.Percentage of under estimation of bandwidth by using Carson rule (percent) = \",BW\n",
+ "print \"It means that cason s rule under estimates the band-width by 25% as compared with the result obtained from the universal curve.\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Bandwidth of FM signal (kHz) = 180.0\n",
+ "ii.Bandwidth obtained by replacing m_f by D (kHz) = 240.0\n",
+ "iii.Percentage of under estimation of bandwidth by using Carson rule (percent) = 25.0\n",
+ "It means that cason s rule under estimates the band-width by 25% as compared with the result obtained from the universal curve.\n"
+ ]
+ }
+ ],
+ "prompt_number": 41
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 30 - pg 257"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the fraction of signal power \n",
+ "\n",
+ "#given\n",
+ "m_f1 = 1.#modualtion index for first case\n",
+ "m_f2 = 10.#modualtion index for second case\n",
+ "#let\n",
+ "f_m = 1.*10**3#modulating frequency\n",
+ "\n",
+ "#calulations\n",
+ "#the bandwidth for FM signal can be calculated on the basis of 98% power requirement given by Carson's rule\n",
+ "BW1 = 2*(m_f1+1)*f_m#bandwidth for first case\n",
+ "B1 = (2*m_f1 +1)*f_m#frequency band first case\n",
+ "BW2 = 2*(m_f2+1)*f_m#bandwidth for second case\n",
+ "B2 = (2*m_f2 +1)*f_m#frequency band second case\n",
+ "P1 = (B1/BW1)*(98.)#fraction of signal power that is included in freuency band for 1st case\n",
+ "P2 = (B2/BW2)*(98.)#fraction of signal power that is included in freuency band for 2nd case\n",
+ "\n",
+ "#results\n",
+ "print \"i.Fraction of signal power that is included in freuency band for 1st case (percent) = \",P1\n",
+ "print \"ii.Fraction of signal power that is included in freuency band for 2nd case (percent) = \",round(P2,1)\n",
+ "print \"Note: Their is mistake in calculation of fraction of power of second case in text book\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Fraction of signal power that is included in freuency band for 1st case (percent) = 73.5\n",
+ "ii.Fraction of signal power that is included in freuency band for 2nd case (percent) = 93.5\n",
+ "Note: Their is mistake in calculation of fraction of power of second case in text book\n"
+ ]
+ }
+ ],
+ "prompt_number": 47
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 31 - pg 257"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate te bandwidth of FM signal in both cases\n",
+ "\n",
+ "#given\n",
+ "f_m1 = 2.*10**3#modulating frequency for first case\n",
+ "delta_f1= 5.*10**3#frequency deviation for first case\n",
+ "f_m2 = 1.*10**3#modulating frequency for second case\n",
+ "delta_f2 = 3.*5*10**3#modulating frequency for second case\n",
+ "\n",
+ "#calculations\n",
+ "BW1 = 2*(delta_f1 + f_m1)#bandwidth of the FM signal for first case\n",
+ "BW2 = 2*(delta_f2 + f_m2)#bandwidth of the FM signal for secpnd case\n",
+ "\n",
+ "#results\n",
+ "print \"i.Bandwidth of the FM signal for first case (kHz) = \",BW1/1000.\n",
+ "print \"ii.Bandwidth of the FM signal for second case (kHz) = \",BW2/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Bandwidth of the FM signal for first case (kHz) = 14.0\n",
+ "ii.Bandwidth of the FM signal for second case (kHz) = 32.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 46
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 32 - pg 258"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier power and in each side band\n",
+ "\n",
+ "#given\n",
+ "m_f = .2#modulation index\n",
+ "P = 10.*10**3#power of FM transmitter\n",
+ "J_0m_f = 0.99#bessel function\n",
+ "J_1m_f =0.099\n",
+ "\n",
+ "#calculations\n",
+ "P_c = (J_0m_f)**2 * P#carrier power\n",
+ "P_s1 = (J_1m_f)**2 * P#power in each side frequency\n",
+ "P_s2 = P_s1\n",
+ "\n",
+ "#results\n",
+ "print \"i.Carrier power (kW) = \",round(P_c/1000.,1)\n",
+ "print \"ii.power in each side band (W) = \",round(P_s1,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Carrier power (kW) = 9.8\n",
+ "ii.power in each side band (W) = 98.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 45
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 33 - pg 258"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier swing, modulation index, highest and lowest frequencies attained\n",
+ "\n",
+ "#given\n",
+ "f_m = 7.*10**3#modulating frequency\n",
+ "delta_f = 50.*10**3#frequency deviation\n",
+ "f_c = 107.6*10**6#carrier frequency\n",
+ "\n",
+ "#calculaitons\n",
+ "CS = 2*delta_f#carrier swing\n",
+ "m_f = delta_f/f_m#modulation index\n",
+ "f_h = f_c + delta_f#upper or highest frequency\n",
+ "f_l = f_c - delta_f#lower of lowest frequency\n",
+ "\n",
+ "#results\n",
+ "print \"i.a.Carrier swing (kHz) = \",CS/10**3\n",
+ "print \" b.Modulation index = \",round(m_f,3)\n",
+ "print \"ii.a.Highest frequency attained by the FM signal (MHz) = \",round(f_h/10**6,2)\n",
+ "print \" b.Lowest frequency attained by the FM signal (MHz) = \",round(f_l/10**6,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.a.Carrier swing (kHz) = 100.0\n",
+ " b.Modulation index = 7.143\n",
+ "ii.a.Highest frequency attained by the FM signal (MHz) = 107.65\n",
+ " b.Lowest frequency attained by the FM signal (MHz) = 107.55\n"
+ ]
+ }
+ ],
+ "prompt_number": 48
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 34 - pg 259"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the frequency deviation and carrier frequency\n",
+ "\n",
+ "#given\n",
+ "f_c = 100.*10**6#carrier frequency\n",
+ "f_u = 100.007*10**6#upper frequency\n",
+ "\n",
+ "#calculations\n",
+ "delta_f = f_u - f_c#frequency deviation\n",
+ "CS = 2*delta_f#carrier swing\n",
+ "f_l = f_c - delta_f#lower frequency reached by the modulated FM wave \n",
+ "\n",
+ "#results\n",
+ "print \"i.Frequency deviation (kHz) = \",delta_f/10**3\n",
+ "print \"ii.Carrier frequency (kHz) = \",CS/10**3\n",
+ "print \"iii.Lower frequency reached by the modulated FM wave (MHz) = \",round(f_l/10**6,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Frequency deviation (kHz) = 7.0\n",
+ "ii.Carrier frequency (kHz) = 14.0\n",
+ "iii.Lower frequency reached by the modulated FM wave (MHz) = 99.993\n"
+ ]
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 35 - pg 259"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Percentage modulation index\n",
+ "\n",
+ "#given\n",
+ "CS = 125.*10**3#carrier swing\n",
+ "\n",
+ "#calculations\n",
+ "delta_f = CS/2#frequency deviation\n",
+ "#since,maximum frequency deviation for the FM broadcast band is 75 KHz, therefore \n",
+ "f_m = 75.*10**3#modulating frequency\n",
+ "m_f = delta_f*100/f_m#modulation index\n",
+ "\n",
+ "#result\n",
+ "print \"Percentage modulation index (percent) = \",round(m_f,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Percentage modulation index (percent) = 83.3\n"
+ ]
+ }
+ ],
+ "prompt_number": 51
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 36 - pg 259"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the frequency deviation and modulation index for all cases\n",
+ "\n",
+ "#given\n",
+ "#first case\n",
+ "f_m1 = 500.#modulating frequency\n",
+ "delta_f1 = 6.4*10**3#frequency deviation\n",
+ "V_m1 = 3.2#modulating amplitude\n",
+ "#second case\n",
+ "V_m2 = 8.4#modulating amplitude\n",
+ " #third case\n",
+ "V_m3 = 20.#modulating amplitude\n",
+ "f_m3 = 200.#modulating frequency\n",
+ "\n",
+ "#calculations\n",
+ "k_f = delta_f1/V_m1#frequency sensitivity\n",
+ "delta_f2 = k_f*V_m2#frequency deviation for second case\n",
+ "delta_f3 = k_f*V_m3#frequency deviation for third case\n",
+ "m_1 = delta_f1/f_m1#modulation index for first case\n",
+ "m_2 = delta_f2/f_m1#modulation index for second case\n",
+ "m_3 = delta_f3/f_m3#modulation index for third case\n",
+ "\n",
+ "#results\n",
+ "print \"i.a.Frequency deviation for first case (kHz) = \",delta_f1/10**3\n",
+ "print \" b.Modulation index for first case = \",m_1\n",
+ "print \"ii.a.Frequency deviation for second case (kHz) = \",delta_f2/10**3\n",
+ "print \" b.Modulation index for second case = \",m_2\n",
+ "print \"iii.a.Frequency deviation for third case (kHz) = \",delta_f3/10**3\n",
+ "print \" b.Modulation index for third case = \",m_3\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.a.Frequency deviation for first case (kHz) = 6.4\n",
+ " b.Modulation index for first case = 12.8\n",
+ "ii.a.Frequency deviation for second case (kHz) = 16.8\n",
+ " b.Modulation index for second case = 33.6\n",
+ "iii.a.Frequency deviation for third case (kHz) = 40.0\n",
+ " b.Modulation index for third case = 200.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 53
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 37 - pg 260"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the carrier frequency, modulating frequency, modulation index, frequency deviation and power dissipated by the wave\n",
+ "import math\n",
+ "#given\n",
+ "# s(t) = 20*sin(6*10**8*t + 7*sin(1250*t))\n",
+ "#comparing with standard eqn s(t) = A*sin(w_c*t + m_f*sin(w_m*t))\n",
+ "#we get \n",
+ "w_c = 6.*10**8#carrier angular frequency in rad/sec\n",
+ "w_m = 1250.#modulating angular frequency in rad/sec\n",
+ "m_f = 7.#modualation index\n",
+ "A = 20.#amplitude of modulated wave\n",
+ "R = 100.#resistance\n",
+ "\n",
+ "#calculations\n",
+ "f_c = w_c/(2*math.pi)#carrier frequency in hertz\n",
+ "f_m = w_m/(2*math.pi)#modulating frequency in hertz\n",
+ "delta_f = m_f*f_m#frequency deviation\n",
+ "P = (A/math.sqrt(2))**2/R#power dissipated\n",
+ "\n",
+ "#results\n",
+ "print \"i.Carrier frequency (MHz) = \",round(f_c/10**6,1)\n",
+ "print \"ii.Modulating frequency (Hz) = \",round(f_m,0)\n",
+ "print \"iii.Modulation index = \",m_f\n",
+ "print \"iv.Frequency deviation (Hz) = \",round(delta_f,0)\n",
+ "print \"v.Power dissipated by FM wave (W) = \",P\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Carrier frequency (MHz) = 95.5\n",
+ "ii.Modulating frequency (Hz) = 199.0\n",
+ "iii.Modulation index = 7.0\n",
+ "iv.Frequency deviation (Hz) = 1393.0\n",
+ "v.Power dissipated by FM wave (W) = 2.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 54
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 39 - pg 261"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the maximum frequency deviation\n",
+ "import math\n",
+ "#given\n",
+ "#x_c(t) = 10*cos[(10**8*math.pi*t) + 5*sin(2*math.pi*10**3)t]\n",
+ "#by comparing the given x_c(t) with standard FM wave equation\n",
+ "t=10;\n",
+ "w_c = 10**8#carreier frequency\n",
+ "phi_t = 5*math.sin(2*math.pi*10**3*t);\n",
+ "phi_1t = 5*2*math.pi*10**3*math.cos(2*math.pi*10**3*t)\n",
+ "#Therefore, the maximum phase deviation will be\n",
+ "phi_tmax = 5#radians\n",
+ "\n",
+ "#calculation\n",
+ "delta_f = (5*10**3*2*math.pi)/(2*math.pi);#maximum frequency deviation\n",
+ "\n",
+ "#results\n",
+ "print \"Maximum frequency deviation is (kHz) = \",delta_f/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum frequency deviation is (kHz) = 5.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 55
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 43 - pg 263"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the bandwidth\n",
+ "import math\n",
+ "#given\n",
+ "#x_c(t) = 10*cos(2*math.pi*10**8*t + 200*cos (2*math.pi*10**3*t))\n",
+ "#instantaneous frequecy w_i = 2*math.pi*10**8 - 4*math.pi*10**6*sin(2*math.pi*10**3)\n",
+ "delta_w = 4*math.pi*10**5#angular frequency deviation\n",
+ "w_m = 2*math.pi*10**3#angulat modulating frequency\n",
+ "\n",
+ "#calculations \n",
+ "beeta = delta_w/w_m;\n",
+ "W_B1 = 2*(beeta + 1)*w_m;#angular bandwidth\n",
+ "#since beeta >>1,therefore\n",
+ "W_B1 = 2*delta_w#angular bandwidth\n",
+ "#W_B==W_B1\n",
+ "f_B = W_B1/(2*math.pi)#bandwidth in Hz\n",
+ "\n",
+ "#result\n",
+ "print \"Bandwidth (kHz) = \",f_B/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Bandwidth (kHz) = 400.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 44 - pg 263"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the modulation index and bandwidth for all cases\n",
+ "\n",
+ "#given\n",
+ "f_c = 20.*10**6#carrier frequency\n",
+ "delta_f = 100.*10**3#frequency deviation\n",
+ "f_m1 = 1.*10**3#modulation index for first case\n",
+ "f_m2 = 100.*10**3#modulation index for second case\n",
+ "f_m3 = 500.*10**3#modulation index for third case \n",
+ "\n",
+ "#calculations\n",
+ "beeta1 = delta_f/f_m1\n",
+ "beeta2 = delta_f/f_m2\n",
+ "beeta3 = delta_f/f_m3\n",
+ "m_f1 = delta_f/f_m1#modulation index for first case\n",
+ "m_f2 = delta_f/f_m2#modulation index for second case\n",
+ "m_f3 = delta_f/f_m3#modulation index for third case\n",
+ "f_B1 = 2*delta_f#bandwidth for first case since it is a WBFM signal\n",
+ "f_B2 = 2*(beeta2 + 1)*f_m2#bandwidth for second case\n",
+ "f_B3 = 2*f_m3#bandwidth for third case since it is a NBFM signal\n",
+ "\n",
+ "#results\n",
+ "print \"i.a.Modulation index for first case = \",m_f1\n",
+ "print \" b.Bandwidth for first case (kHz) = \",f_B1/1000.\n",
+ "print \"ii.a.Modulation index for second case = \",m_f2\n",
+ "print \" b.Bandwidth for second case (kHz) = \",f_B2/1000.\n",
+ "print \"iIi.a.Modulation index for third case = \",m_f3\n",
+ "print \" b.Bandwidth for third case (MHz) = \",f_B3/10**6\n",
+ "print \"Note:Their is error in first case modulating frequency in text book\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.a.Modulation index for first case = 100.0\n",
+ " b.Bandwidth for first case (kHz) = 200.0\n",
+ "ii.a.Modulation index for second case = 1.0\n",
+ " b.Bandwidth for second case (kHz) = 400.0\n",
+ "iIi.a.Modulation index for third case = 0.2\n",
+ " b.Bandwidth for third case (MHz) = 1.0\n",
+ "Note:Their is error in first case modulating frequency in text book\n"
+ ]
+ }
+ ],
+ "prompt_number": 57
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 45 - pg 263"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the bandwidth in all cases\n",
+ "\n",
+ "#given\n",
+ "#x_c(t) = 10*cos(w_c*t + 3*sin(w_m*t))\n",
+ "#comparing with std eqn of PM signal x_PM(t) = A*cos(w_c*t + k_p*m(t))\n",
+ "#m(t) = a_m*sin(w_m*t)\n",
+ "#beeta = k_p*a_m\n",
+ "beeta = 3;\n",
+ "f_m1 = 1.*10**3#modulating frequency for first case\n",
+ "f_m2 = 2.*10**3#modulating frequency for second case\n",
+ "f_m3 = 500.#modulating frequency for third case\n",
+ "\n",
+ "#calculations\n",
+ "f_B1 = 2*(beeta + 1)*f_m1#bandwidth for first case\n",
+ "f_B2 = 2*(beeta + 1)*f_m2#bandwidth for first case\n",
+ "f_B3 = 2*(beeta + 1)*f_m3#bandwidth for first case\n",
+ "\n",
+ "#results\n",
+ "print \"i.Bandwidth for first case (kHz) = \",f_B1/1000.\n",
+ "print \"ii.Bandwidth for second case (kHz) = \",f_B2/1000.\n",
+ "print \"ii.Bandwidth for third case (kHz) = \",f_B3/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Bandwidth for first case (kHz) = 8.0\n",
+ "ii.Bandwidth for second case (kHz) = 16.0\n",
+ "ii.Bandwidth for third case (kHz) = 4.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 58
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 46 - pg 264"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the bandwidth in all cases\n",
+ "\n",
+ "#given\n",
+ "#x_cFM(t) = 10*cos(w_c*t + 3*sin(w_m*t))\n",
+ "#by omparing with standard equation i.e A*cos(w_c*t + beta*sin(w_m*t))\n",
+ "#we get\n",
+ "beta = 3.\n",
+ "\n",
+ "#calculations\n",
+ "#first case\n",
+ "f_m1 = 1.*10**3#modulating frequency for first case\n",
+ "f_B1 = 2.*(beta +1)*f_m1#bandwidth for first case\n",
+ "#second case\n",
+ "beta2 = 3./2#beta for second case\n",
+ "f_m2 = 2.*10**3#modulating frequency for second case\n",
+ "f_B2 = 2.*(beta2 +1)*f_m2#bandwidth for second case\n",
+ "#third case\n",
+ "beta3 = 6.#beta for third case\n",
+ "f_m3 = .5*10**3#modulating frequency for third case\n",
+ "f_B3 = 2*(beta3 +1)*f_m3#bandwidth for third case\n",
+ "\n",
+ "#results\n",
+ "print \"i.Bandwidth for first case (Hz) = \",f_B1/1000.\n",
+ "print \"ii.Bandwidth for second case (Hz) = \",f_B2/1000.\n",
+ "print \"ii.Bandwidth for third case (Hz) = \",f_B3/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Bandwidth for first case (Hz) = 8.0\n",
+ "ii.Bandwidth for second case (Hz) = 10.0\n",
+ "ii.Bandwidth for third case (Hz) = 7.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 59
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 47 - pg 264"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the bandwidth, frequency deviation\n",
+ "\n",
+ "#given\n",
+ "f_m = 2.*10**3#modulating frequency for first case\n",
+ "delta_f1 = 5.*10**3#frequency deviation for first case\n",
+ "f_m1 = 1.*10**3#modulating frequency for second case\n",
+ "#beeta = (k_f*a_m)/(w_m) = delta_f/f_m\n",
+ "\n",
+ "#calculations\n",
+ "beeta = delta_f1/f_m\n",
+ "f_B1 = 2*(beeta + 1)*f_m#bandwidth for first case\n",
+ "#beeta1 = (k_f*3*a_m)/(.5*w_m) = delta_f/f_m therefore\n",
+ "beeta1 = 6*beeta\n",
+ "delta_f2 = beeta1 * f_m1 #frequency deviation for second case\n",
+ "f_B2 = 2*(beeta1 + 1)*f_m1#bandwidth for second case\n",
+ "\n",
+ "#results\n",
+ "print \"i.Bandwidth for first case (kHz) = \",f_B1/1000.\n",
+ "print \"ii.a.Frequency deviation for second case (kHz) = \",delta_f2/1000.\n",
+ "print \" b.Bandwidth for second case (kHz) = \",f_B2/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Bandwidth for first case (kHz) = 14.0\n",
+ "ii.a.Frequency deviation for second case (kHz) = 15.0\n",
+ " b.Bandwidth for second case (kHz) = 32.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 60
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 48 - pg 264"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the bandwidth\n",
+ "\n",
+ "#given\n",
+ "delta_f = 75.*10**3#frequency deviation\n",
+ "f_M = 15.*10**3#modulating frequency\n",
+ "\n",
+ "#calculations\n",
+ "#we have w_m = 2*%pi*f_M where f_M = 15KHz,we get\n",
+ "D = delta_f/f_M#deviation ratio\n",
+ "#by using thr given formula, the bandwidth will be\n",
+ "f_B1 = 2*(D+2)*f_M\n",
+ "#Using Carson's rule, the bandwidt will be \n",
+ "f_B2 = 2*(D+1)*f_M\n",
+ "\n",
+ "#results \n",
+ "print \"i.Bandwidth calculation using the given formula (kHz) = \",f_B1/1000.\n",
+ "print \"ii.Bandwidth calculation using the carson rule (kHz) = \",f_B2/1000.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Bandwidth calculation using the given formula (kHz) = 210.0\n",
+ "ii.Bandwidth calculation using the carson rule (kHz) = 180.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 62
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 49 - pg 265"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the frequency multiplication and maximum allowed frequency deviation\n",
+ "\n",
+ "#given\n",
+ "#x_NBFM(t) = A*cos(w_c*t + sin(w_m*t))\n",
+ "f_c = 200.*10**3#carrier frequency\n",
+ "f_m_max = 15.*10**3#maximum modulating frequency\n",
+ "f_m_min = 50.#minimum modulating frequency\n",
+ "delta_f = 75.*10**3#maximum frequency deviation\n",
+ "\n",
+ "#calculations\n",
+ "beeta_min = delta_f/f_m_max;\n",
+ "beeta_max = delta_f/f_m_min;\n",
+ "#if beeta_1 =.5, where beeta_1 is the input beeta, then the required frequency multiplication will be\n",
+ "beeta_1 = .5\n",
+ "n = beeta_max/beeta_1#frequency multiplication \n",
+ "delta_f1 = delta_f/n#maximum allowed frequency deviation\n",
+ "\n",
+ "#results\n",
+ "print \"i.Frequency multiplication = \",n\n",
+ "print \"ii.Maximum allowed frequency deviation (Hz) = \",delta_f1\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Frequency multiplication = 3000.0\n",
+ "ii.Maximum allowed frequency deviation (Hz) = 25.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 63
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 50 - pg 265"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the maximum frequency deviation and carrier frequency\n",
+ "\n",
+ "#given\n",
+ "f_1 = 200.*10**3#frequency applied at first stage \n",
+ "delta_f1 = 25.#frequency deviation at first stage\n",
+ "n1 = 64.#frequency multiplication at first stage\n",
+ "n2 = 48.#frequency multiplication at second stage\n",
+ "f_LO = 10.8*10**6#frequency of oscillator as shown if block diagram\n",
+ "\n",
+ "#calculations\n",
+ "delta_f = delta_f1*n1*n2#maximum frequency deviation\n",
+ "f_2 = n1*f_1#frequency applied at second stage\n",
+ "f_3a = f_2 + f_LO#frequency applied the third stage \n",
+ "f_3b = f_2 - f_LO#frequency applied the third stage\n",
+ "f_c1 = n2*f_3a#carrier frequency for maximun f_3\n",
+ "f_c2 = n2*f_3b#carrier frequency for minimum f_3\n",
+ "\n",
+ "#results\n",
+ "print \"i.Maximum frequency deviation (kHz) = \",delta_f/1000.\n",
+ "print \"ii.a.Carrier frequency for maximum f_3 (MHz) = \",f_c1/1000000.\n",
+ "print \" b.Carrier frequency for minimum f_3 (MHz) = \",f_c2/1000000.\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Maximum frequency deviation (kHz) = 76.8\n",
+ "ii.a.Carrier frequency for maximum f_3 (MHz) = 1132.8\n",
+ " b.Carrier frequency for minimum f_3 (MHz) = 96.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 64
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 51 - pg 266"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the mixer oscillator frequency\n",
+ "\n",
+ "#given\n",
+ "f_c = 108.*10**6#carrier frequency\n",
+ "f_1 = 2.*10**5#crystal oscillator frequency\n",
+ "beta = .2#phase deviation\n",
+ "f_m = 50.#minimum frequency \n",
+ "delta_f = 75.*10**3#frequency deviation\n",
+ "n_2 = 150.\n",
+ "\n",
+ "#calculations\n",
+ "delta_f1 = beta * f_m;\n",
+ "n_12 = delta_f /delta_f1;\n",
+ "#f_2 = n_1*f_1 = n_1 * 2*10**5Hz\n",
+ "#assuming down convertions, we have\n",
+ "#f_2 - f_LO = (f_c/n_2)\n",
+ "#thus\n",
+ "f_LO = ((n_12*f_1) - f_c)/n_2;\n",
+ "n_1 = n_12/n_2\n",
+ "\n",
+ "#results\n",
+ "print \" n_1 = \",n_1\n",
+ "print \" Mixer oscillator frequency (MHz) = \",f_LO/10**6\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " n_1 = 50.0\n",
+ " Mixer oscillator frequency (MHz) = 9.28\n"
+ ]
+ }
+ ],
+ "prompt_number": 65
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 52 - pg 266"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the frequency multiplication for both PM and FM waves\n",
+ "\n",
+ "#given\n",
+ "delta_f = 50.#frequency deviation\n",
+ "delta_f2 = 20.*10**3#frequency deviation for sinusoidal FM wave i.e second case\n",
+ "f_m1 = 120.#modualting frequency for first case\n",
+ "f_m2 = 240.#modulating frquency for second case\n",
+ "\n",
+ "#calculations\n",
+ "#first case\n",
+ "delta_f1 = (f_m2/f_m1)*delta_f#frequency deviation for sinusoidal PM wave\n",
+ "n1 = delta_f2/delta_f1#frequency multiplication for sinusoidal PM wave\n",
+ "#second case\n",
+ "n2 = delta_f2/delta_f#frequency multiplication for sinusoidal FM wave\n",
+ "\n",
+ "#results\n",
+ "print \"i.Frequency multiplication for PM wave = \",n1\n",
+ "print \"ii.Frequency multiplication for FM wave = \",n2\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Frequency multiplication for PM wave = 200.0\n",
+ "ii.Frequency multiplication for FM wave = 400.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 66
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Analog_and_digital_communication_by_S_Sharma/Chapter6.ipynb b/Analog_and_digital_communication_by_S_Sharma/Chapter6.ipynb
new file mode 100755
index 00000000..c8a6cc8e
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/Chapter6.ipynb
@@ -0,0 +1,785 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:aabc27335f32d474a45f64beecf83a23fa9bf81cfd70dd0ed540cf40b23a5726"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6 - Noise"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - pg 281"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the RMS noise voltage\n",
+ "import math\n",
+ "#given\n",
+ "R = 10.*10**3#resistance of amplifier in ohms\n",
+ "T = 273.+27#temperature in kelvin\n",
+ "B = (20.-18)*10**6#bandwidth\n",
+ "k = 1.38*10**-23#boltzman's constant\n",
+ "\n",
+ "#calculations\n",
+ "V_n = math.sqrt(4*R*k*T*B)*10**6;#rms noise voltage\n",
+ "\n",
+ "#result\n",
+ "print \"Rms noise voltage (muV) = \",round(V_n,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rms noise voltage (muV) = 18.2\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - pg 281"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the RMS noise voltage\n",
+ "import math\n",
+ "#given\n",
+ "R_1 = 300.#equivalent noise resistance\n",
+ "R_2 = 400.#input resistance\n",
+ "T = 273+27.#temperature in kelvin\n",
+ "B = 7.*10**6#bandwidth\n",
+ "k = 1.38*10**-23#boltzman's constant\n",
+ "\n",
+ "#calculations\n",
+ "R_s = R_1 +R_2#effective resistance in series\n",
+ "V_nr = math.sqrt(4*k*T*B*R_s)*10**6#rms noise voltage\n",
+ "\n",
+ "#result \n",
+ "print \"Rms noise voltage (muV) = \",round(V_nr,0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rms noise voltage (muV) = 9.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - pg 282"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Noise voltage in all cases\n",
+ "import math\n",
+ "from math import sqrt\n",
+ "#given\n",
+ "R_1 = 20*10**3#resistance one\n",
+ "R_2 = 50*10**3#resistance two\n",
+ "T = 273+15#temperature in kelvin\n",
+ "B = 100*10**3#bandwidth\n",
+ "k = 1.38*10**-23#boltzman's constant\n",
+ "\n",
+ "#calculations\n",
+ "R_s = R_1 +R_2#series effective resistance\n",
+ "R_p = (R_1*R_2)/(R_1 + R_2)#parallel effective resistance\n",
+ "V_1 = sqrt(4*k*T*R_1*B)*10**6#noise voltage in R_1\n",
+ "V_2 = sqrt(4*k*T*R_1*B)*10**6#noise voltage in R_2\n",
+ "V_s = sqrt(4*k*T*R_s*B)*10**6#noise voltage when resistance connected in series\n",
+ "V_p = sqrt(4*k*T*R_p*B)*10**6#noise voltage when resistance connected in parallel\n",
+ "\n",
+ "#results\n",
+ "print \"i.Noise voltage due to R_1 (muV) = \",round(V_1,2)\n",
+ "print \"ii.Noise voltage due to R_2 (muV) = \",round(V_2,2)\n",
+ "print \"iii.Noise voltage due to two resistance in series (muV) = \",round(V_s,2)\n",
+ "print \"iv.Noise voltage due to two resistance in parallel (muV) = \",round(V_p,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Noise voltage due to R_1 (muV) = 5.64\n",
+ "ii.Noise voltage due to R_2 (muV) = 5.64\n",
+ "iii.Noise voltage due to two resistance in series (muV) = 10.55\n",
+ "iv.Noise voltage due to two resistance in parallel (muV) = 4.77\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4 - pg 283"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Equivalent input noise resistance\n",
+ "\n",
+ "#given\n",
+ "A_1 = 10.#voltage gain for first stage\n",
+ "A_2 = 25.#volatage gain for second stage\n",
+ "R_i1 = 600.#input resistance for first stage in ohms\n",
+ "R_eq1 = 1600.#equivalent noise resistance for first stage \n",
+ "R_01 = 27.*10**3#Output resistance for first stage \n",
+ "R_i2 = 81.*10**3#input resistance for second stage\n",
+ "R_eq2 = 10.*10**3#Equivalent noise resistance for second stage \n",
+ "R_02 = 1.*10**6#putput resistance for second case\n",
+ "\n",
+ "#calculations\n",
+ "R_1 = R_i1 + R_eq1\n",
+ "R_2 = ((R_01*R_i2)/(R_01+R_i2)) + R_eq2\n",
+ "R_3 = R_02\n",
+ "R_eq = R_1 + (R_2/A_1**2) + R_3/(A_1**2 *A_2**2);\n",
+ "\n",
+ "#results\n",
+ "print \"Equivalent input noise resistance (Ohms) = \",round(R_eq,0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Equivalent input noise resistance (Ohms) = 2519.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7 - pg 295"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the output voltage\n",
+ "import math\n",
+ "#given\n",
+ "T = 273. + 17#temperature in kelvin\n",
+ "Q = 10.#quality factor\n",
+ "c = 10.*10**-12#capacitance\n",
+ "f_r = 100.*10**6#resonate frequency\n",
+ "k = 1.38*10**-23#boltzman's constant\n",
+ "\n",
+ "#calculations\n",
+ "delta_f = f_r/Q#bandwidth of the tuned circuit\n",
+ "w = 2*math.pi*f_r;#angular frequency\n",
+ "R = 1/(Q*w*c);#resistance\n",
+ "V_no = math.sqrt(4*k*Q**2*T*delta_f*R)*10**6 #output voltage\n",
+ "\n",
+ "#results\n",
+ "print \"Output voltge (V) = \",round(V_no,0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Output voltge (V) = 16.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8 - pg 297"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Noise figure and Equivalent temperature\n",
+ "import math\n",
+ "#given\n",
+ "R_a = 50.#antenna resistance\n",
+ "R_eq = 30.#equivalent noise resistance of receiver\n",
+ "T_0 = 290.#initial temperature in degree kelvin\n",
+ "#calculations\n",
+ "F = 1+(R_eq/R_a);#noise figure\n",
+ "F_dB = 10*math.log10(F)#noise figure in decibels\n",
+ "T_eq = T_0*(F-1)#equivalent temperature\n",
+ "\n",
+ "#results\n",
+ "print \"i.Noise figure in decibels (dB) = \",round(F_dB,2)\n",
+ "print \"ii.Equivalent temperature (degree kelvin) = \",T_eq\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Noise figure in decibels (dB) = 2.04\n",
+ "ii.Equivalent temperature (degree kelvin) = 174.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 9 - pg 302"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Noise figure\n",
+ "import math\n",
+ "#given\n",
+ "R_eq = 2518.#equivalent resistance in ohms\n",
+ "R_t = 600.#input impedence in ohms\n",
+ "R_a= 50.#output impedencre in ohms\n",
+ "\n",
+ "#calculations\n",
+ "R_eq1 = R_eq - R_t;\n",
+ "F = 1 + (R_eq1/R_a) #noise figure\n",
+ "F_dB = 10*math.log10(F)#noise figure in dB\n",
+ "\n",
+ "#results\n",
+ "print \"Noise figure in dB = \",round(F_dB,2)\n",
+ "print \"Note:Calculation mistake is their in text book in finding noise figure in dB\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Noise figure in dB = 15.95\n",
+ "Note:Calculation mistake is their in text book in finding noise figure in dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10 - pg 305"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Overall noise figure\n",
+ "import math\n",
+ "from math import exp, log10,log\n",
+ "#given\n",
+ "F_1 = 2.#noise figure of first stage in dB\n",
+ "A_1 = 12.#gain in first stage in dB\n",
+ "F_2 = 6.#noise figure of second stage in dB\n",
+ "A_2 = 10.#gain in first second in dB \n",
+ "\n",
+ "\n",
+ "#calculations\n",
+ "F_1ratio = exp((F_1/10)*log(10));#noise figure of first stage in ratio \n",
+ "F_2ratio = exp((F_2/10)*log(10));#noise figure of second stage in ratio \n",
+ "A_1ratio = exp((A_1/10)*log(10));#gain of first stage in ratio\n",
+ "A_2ratio = exp((A_2/10)*log(10));#gain of second stage in ratio\n",
+ "F = F_1ratio + ((F_2ratio - 1)/(A_1ratio));#Overall noise figure \n",
+ "F_dB = 10*log10(F);#Overall noise figure in dB\n",
+ "\n",
+ "#results\n",
+ "print \"Overall noise figure (dB) = \",round(F_dB ,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Overall noise figure (dB) = 2.5\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11 - pg 306"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Overall noise figure\n",
+ "import math\n",
+ "from math import exp, log10,log\n",
+ "#given\n",
+ "F_1 = 9.#noise figure for first stage in dB\n",
+ "F_2 = 20.#noise figure for second stage in dB\n",
+ "A_1 = 15.#gain in first stage in dB\n",
+ "\n",
+ "#calculations\n",
+ "F_1ratio = exp((F_1/10)*log(10));#noise figure of first stage in ratio \n",
+ "F_2ratio = exp((F_2/10)*log(10));#noise figure of second stage in ratio \n",
+ "A_1ratio = exp((A_1/10)*log(10));#gain of first stage in ratio\n",
+ "F = F_1ratio + ((F_2ratio - 1)/(A_1ratio));\n",
+ "F_dB = 10*log10(F);\n",
+ " \n",
+ "#results\n",
+ "print \"Overall noise figure (dB) = \", round(F_dB,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Overall noise figure (dB) = 10.44\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 12 - pg 307"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the rms noise voltage\n",
+ "import math\n",
+ "#given\n",
+ "f_1 = 18.*10**6#lower operating frequency in Hz\n",
+ "f_2 = 20.*10**6#lower operating frequency in Hz\n",
+ "T = 273. + 17#temperature in kelvin\n",
+ "R = 10.*10**3#input resistance\n",
+ "k = 1.38*10**-23#boltzman's constant\n",
+ "\n",
+ "#calculations\n",
+ "B = f_2 - f_1#bandwidth in Hz\n",
+ "V_n = math.sqrt(4*k*B*R*T)*10**6;#rms noise voltage\n",
+ "\n",
+ "#results\n",
+ "print \"rms noise voltage (muV) = \",round(V_n,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "rms noise voltage (muV) = 17.9\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14 - pg 308"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Meter reading, resistance\n",
+ "\n",
+ "#given\n",
+ "A = 60.#gain of noiseless amplifier\n",
+ "V_n1 = 1.*10**-3#output of the amplifier\n",
+ "B = 20.*10**3#initial bandwidth\n",
+ "B1 = 5.*10**3#change in bandwidth\n",
+ "k = 1.38*10**-23#boltzman's constant\n",
+ "T = 273. + 80#temperature in degree kelvin\n",
+ "\n",
+ "#calculaitons\n",
+ "#since the bandwidth is reesuced to 1/4th of its value,therefore the noise voltage \n",
+ "#will be V_n proportional to sqrt(B)\n",
+ "#Hence, the noise voltage at 5KHz will become half its value at 20KHz bandwidth i.e,\n",
+ "V_n = .5*10**-3#noise voltage in volts\n",
+ "V_no = V_n1/A;#noise ouput voltage \n",
+ "R = (V_no**2/(4*k * T * B ));#resistance at 80degree celcius\n",
+ "\n",
+ "#results\n",
+ "print \"i.Meter reading in volts (V) = \",V_n\n",
+ "print \"ii.Resistance at 80 degree celcius (kohms) = \",round(R/1000.,0)\n",
+ "print \"Note: There is calculation mistake in textbook in the measurement of resistance they took constant in formula as 1 instead of 4\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Meter reading in volts (V) = 0.0005\n",
+ "ii.Resistance at 80 degree celcius (kohms) = 713.0\n",
+ "Note: There is calculation mistake in textbook in the measurement of resistance they took constant in formula as 1 instead of 4\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16 - pg 309"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Overall noise figure\n",
+ "import math\n",
+ "from math import exp, log10,log\n",
+ "#given\n",
+ "A_1 = 10.#gain in first stage in dB\n",
+ "A_2 = 10.#gain in second stage in dB\n",
+ "A_3 = 10.#gain in third stage in dB\n",
+ "F_1 = 6.#noise figure for first stage in dB\n",
+ "F_2 = 6.#noise figure for second stage in dB\n",
+ "F_3 = 6.#noise figure for third stage in dB\n",
+ "\n",
+ "#calculations\n",
+ "F_1ratio = exp((F_1/10)*log(10));#noise figure of first stage in ratio \n",
+ "F_2ratio = exp((F_2/10)*log(10));#noise figure of second stage in ratio \n",
+ "F_3ratio = exp((F_3/10)*log(10));#noise figure in third stage in ratio \n",
+ "A_1ratio = exp((A_1/10)*log(10));#gain of first stage in ratio\n",
+ "A_2ratio = exp((A_2/10)*log(10));#gain of second stage in ratio\n",
+ "A_3ratio = exp((A_3/10)*log(10));#gain of third stage in ratio\n",
+ "F = F_1ratio + ((F_2ratio - 1)/(A_1ratio)) + ((F_3ratio - 1)/(A_2ratio*A_1ratio));#Overall noise figure\n",
+ "\n",
+ "#results\n",
+ "print \"Overall noise figure of three stage cascaded amplifier = \",round(F,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Overall noise figure of three stage cascaded amplifier = 4.31\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 17 - pg 310"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Overall noise figure\n",
+ "import math\n",
+ "from math import exp, log10,log\n",
+ "#given\n",
+ "G_1 = 10.#gain in first stage in dB\n",
+ "#noise figure for both the stages are same\n",
+ "F_1 = 10.#noise figure for first stage in dB\n",
+ "F_2 = 10.#noise figure for second stage in dB\n",
+ "\n",
+ "#calculations\n",
+ "F_1ratio = exp((F_1/10)*log(10));#noise figure of first stage in ratio \n",
+ "F_2ratio = exp((F_2/10)*log(10));#noise figure of second stage in ratio \n",
+ "G_1ratio = exp((G_1/10)*log(10));#gain of first stage in ratio\n",
+ "F = F_1ratio + ((F_2ratio - 1)/(G_1ratio));#Overall noise figure\n",
+ "F_dB= 10*log10(F)##Overall noise figure in dB\n",
+ "\n",
+ "#results\n",
+ "\n",
+ "print \"Overall noise figure (dB) = \", round(F_dB,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Overall noise figure (dB) = 10.37\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 18 - pg 310"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the overall noise figure and overall gain\n",
+ "import math\n",
+ "from math import exp, log10,log\n",
+ "#given\n",
+ "G_1 = 4.#gain in first stage in dB\n",
+ "G_2 = 10.#gain in second stage in dB\n",
+ "F_1 = 10.#noise figure for first stage in dB\n",
+ "F_2 = 10.#noise figure for second stage in dB\n",
+ "\n",
+ "#calculations\n",
+ "F_1ratio = exp((F_1/10)*log(10));#noise figure of first stage in ratio \n",
+ "F_2ratio= exp((F_2/10)*log(10));#noise figure of second stage in ratio \n",
+ "G_1ratio = exp((G_1/10)*log(10));#gain of first stage in ratio\n",
+ "G_2ratio = exp((G_2/10)*log(10));#gain of second stage in ratio\n",
+ "F = F_1ratio + ((F_2ratio - 1)/(G_1ratio));#Overall noise figure \n",
+ "G = log10(G_1ratio *G_2ratio );\n",
+ "F_dB= 10*log10(F)##Overall noise figure in dB\n",
+ "\n",
+ "#results\n",
+ "print \"i.Overall noise figure (dB) = \",round(F_dB,2)\n",
+ "print \"ii.Overall gain (dB) = \",G \n",
+ "print \"Note:There is mistake in calculation of overall gain in textbook\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Overall noise figure (dB) = 11.33\n",
+ "ii.Overall gain (dB) = 1.4\n",
+ "Note:There is mistake in calculation of overall gain in textbook\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 19 - pg 310"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Overall noise figure\n",
+ "import math\n",
+ "from math import exp, log10,log\n",
+ "#given\n",
+ "G_1 = 15.#gain in first stage in dB\n",
+ "F_1 = 9.#noise figure for first stage in dB\n",
+ "F_2 = 20.#noise figure for second stage in dB\n",
+ "\n",
+ "#calculations\n",
+ "F_1ratio = exp((F_1/10)*log(10));#noise figure of first stage in ratio \n",
+ "F_2ratio = exp((F_2/10)*log(10));#noise figure of second stage in ratio \n",
+ "G_1ratio = exp((G_1/10)*log(10));#gain of first stage in ratio\n",
+ "F = F_1ratio + ((F_2ratio - 1)/(G_1ratio));#Overall noise figure \n",
+ "F_dB= 10*log10(F)##Overall noise figure in dB\n",
+ "\n",
+ "#results\n",
+ "print \"Overall noise figure (dB) = \", round(F_dB,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Overall noise figure (dB) = 10.44\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 20 - pg 311"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Noise temperature and overall noise temperature\n",
+ "import math\n",
+ "from math import exp, log10,log\n",
+ "#given\n",
+ "F_2 = 20.#noise figure of receiver in dB\n",
+ "G_1 = 40.#gain of low noise amplifier in dB\n",
+ "T_e1 = 80.#noise temperature of low noise amplifier in degree kelvin\n",
+ "T_0 = 300.#room temperature\n",
+ "\n",
+ "#calculations\n",
+ "F_2ratio = exp((F_2/10)*log(10));#noise figure of receiver in ratio \n",
+ "G_1ratio = exp((G_1/10)*log(10));#gain of low noise amplifier\n",
+ "T_e2 = (F_2ratio-1)*T_0#noise temperature of the receiver in degree kelvin\n",
+ "T_e = T_e1 +(T_e2/G_1ratio)#overall noise temperature in degree kelvin\n",
+ "\n",
+ "#results\n",
+ "print \"i.Noise Temperature of the receiver (degkelvin) = \",T_e2\n",
+ "print \"ii.Overall noise temperature (degkelvin) = \",T_e\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Noise Temperature of the receiver (degkelvin) = 29700.0\n",
+ "ii.Overall noise temperature (degkelvin) = 82.97\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21 - pg 311"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the overall noise temperature and noise figure\n",
+ "import math\n",
+ "#given from the figure\n",
+ "G_1ratio = 1000.#gain of master amplifier \n",
+ "G_2ratio = 100.#gain of TWT\n",
+ "G_3ratio = 10000.#gain of mixer and IF amplifier\n",
+ "F_2ratio = 4.#noise figure of TWT \n",
+ "F_3ratio = 16.#noise figure of mixer and IF amplifier\n",
+ "T_0 =273 + 17.#ambident temperature in degree kelvin\n",
+ "T_e1 = 5.#temperature of master amplifier in degree kelvin\n",
+ "\n",
+ "#calculaitons\n",
+ "F_1 = 1 + (T_e1/T_0);#noise figure of master amplifier\n",
+ "F = F_1 + ((F_2ratio - 1)/(G_1ratio)) + ((F_3ratio - 1)/(G_2ratio*G_1ratio));#Overall noise figure\n",
+ "F_dB = 10*math.log10(F);#overall noise figure in dB\n",
+ "T_e = (F - 1)*T_0;#overall noise temperature of the receiver \n",
+ "\n",
+ "#results\n",
+ "print \"i.Overall noise temperature of the receiver (degreekelvin) = \",round(T_e,0)\n",
+ "print \"ii.Overall noise figure (dB) = \", round(F_dB,5)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Overall noise temperature of the receiver (degreekelvin) = 6.0\n",
+ "ii.Overall noise figure (dB) = 0.08767\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Analog_and_digital_communication_by_S_Sharma/Chapter7.ipynb b/Analog_and_digital_communication_by_S_Sharma/Chapter7.ipynb
new file mode 100755
index 00000000..59c34938
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/Chapter7.ipynb
@@ -0,0 +1,224 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:5d045633a134a6b88641045e0705da6aba6d8735cb400399955dbb6bc55628cc"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 7 - Sampling Theory and Pulse modulation"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 1 - pg 324"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the nyquist rate\n",
+ "\n",
+ "import math\n",
+ "#given\n",
+ "#analog signal x(t) = 3*cos(50*math.pi*t) + 10*sin(300*math.pi*t) - cos(100*math.pi*t)\n",
+ "#comparing signal with x(t) = 3*cos(w_1*t) + 10*sin(w_2*t) - cos(w_3*t)\n",
+ "#therefore\n",
+ "w_1 = 50*math.pi;#first frequency in rad/sec\n",
+ "w_2 = 300*math.pi;#second frequency in rad/sec\n",
+ "w_3 = 100*math.pi;#third frequency in rad/sec\n",
+ "\n",
+ "#calculations\n",
+ "f_1 = w_1/(2*math.pi);#first frequency in Hz\n",
+ "f_2 = w_2/(2*math.pi);#second frequency in Hz\n",
+ "f_3 = w_3/(2*math.pi);#third frequency in Hz\n",
+ "f_m = f_2#maximum frequency \n",
+ "f_s = 2*f_m#nyquist rate for a signal\n",
+ "\n",
+ "#results\n",
+ "print \"Nyquist rate (Hz) = \",f_s\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Nyquist rate (Hz) = 300.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - pg 325"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Nyquist rate and interval\n",
+ "import math\n",
+ "#given\n",
+ "#x(t) = (1/()2*math.pi))*cos(4000*math.pi*t)*cos(1000*math.pi*t)\n",
+ "#expanding\n",
+ "print(\"x(t) = (1/(2*math.pi)*cos(4000*math.pi*t)*cos(1000*math.pi*t)\");\n",
+ "print(\"x(t) = (1/(4*math.pi)*2*cos(4000*math.pi*t)*cos(1000*math.pi*t)\");\n",
+ "print(\"x(t) = (1/(4*math.pi))*[cos(4000*math.pi*t + 1000*pi*t)*cos(4000*math.pi*t - 1000*math.pi*t)]\")\n",
+ "print(\"x(t) = (1/(4*math.pi))*[cos(5000*math.pi*t + cos(3000*math.pi*t))]\")\n",
+ "#by comparing above equation with x(t) = (1/(4*math.pi))*[cos(w_1*t) + cos(w_2*t)] \n",
+ "w_1 = 5000.*math.pi\n",
+ "w_2 = 3000.*math.pi\n",
+ "\n",
+ "#calculations\n",
+ "f_1 = w_1/(2*math.pi);\n",
+ "f_2 = w_2 /(2*math.pi);\n",
+ "f_m = f_1\n",
+ "f_s = 2*f_m#Nyquist rate\n",
+ "T_s = 1/f_s#Nyquist interval\n",
+ "\n",
+ "#results\n",
+ "print \"Nyquist rate (Hz) = \",f_s\n",
+ "print \"Nyquist interval (msec) = \",T_s*1000\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x(t) = (1/(2*math.pi)*cos(4000*math.pi*t)*cos(1000*math.pi*t)\n",
+ "x(t) = (1/(4*math.pi)*2*cos(4000*math.pi*t)*cos(1000*math.pi*t)\n",
+ "x(t) = (1/(4*math.pi))*[cos(4000*math.pi*t + 1000*pi*t)*cos(4000*math.pi*t - 1000*math.pi*t)]\n",
+ "x(t) = (1/(4*math.pi))*[cos(5000*math.pi*t + cos(3000*math.pi*t))]\n",
+ "Nyquist rate (Hz) = 5000.0\n",
+ "Nyquist interval (msec) = 0.2\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - pg 326"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the discrete time signal for all conditions\n",
+ "\n",
+ "#given\n",
+ "#x(t) = 8*cos(200*%pi*t)\n",
+ "f= 100.#highest frequency component of continuous time signal in hertz\n",
+ "f_s2 = 400.#sampling frequency in hertz for second condition\n",
+ "f_s3 = 400.#sampling frequency in hertz for third condition\n",
+ "f_s4 = 150.#sampling frequency in hertz for fourth condition since 0 < f_s4 < f_s2/2 \n",
+ "\n",
+ "#calcultions\n",
+ "NR = 2*f#Nyquist rate\n",
+ "F_1 = f/NR;\n",
+ "F_2 = f/f_s2;\n",
+ "F_3 = f/f_s3;\n",
+ "F_4 = f/f_s4;\n",
+ "f_4 = f_s4*F_4;\n",
+ "\n",
+ "#results\n",
+ "print \"The discrete time signal x(n) for the first condition is x(n) = 8*cos(2*pi*\",F_1,\"*n)\"\n",
+ "print \"the discrete time signal x(n) for the second condition is x(n) = 8*cos(2*pi*\",F_2,\"*n)\"\n",
+ "print \"the discrete time signal x(n) for the third condition is x(n) = 8*cos(2*pi*\",F_3,\"*n)\"\n",
+ "print \"The discrete time signal x(n) for the fourth condition is x(n) = 8*cos(2*pi*\",f_4,\"*t)\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The discrete time signal x(n) for the first condition is x(n) = 8*cos(2*pi* 0.5 *n)\n",
+ "the discrete time signal x(n) for the second condition is x(n) = 8*cos(2*pi* 0.25 *n)\n",
+ "the discrete time signal x(n) for the third condition is x(n) = 8*cos(2*pi* 0.25 *n)\n",
+ "The discrete time signal x(n) for the fourth condition is x(n) = 8*cos(2*pi* 100.0 *t)\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4 - pg 327"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the nyquist rate\n",
+ "import math\n",
+ "#given\n",
+ "#x(t) = 6*cos(50*math.pi*t) + 20*sin(300*math.pi*t) - 10*cos(100*math.pi*t)\n",
+ "#by comparing with standard eqn x(t) = A_1*cos(w_1*t) + A_2*sin(w_2*t) + A_3*cos(w_3*t) we get \n",
+ "w_1 = 50*math.pi#frequency in rad/sec\n",
+ "w_2 =300*math.pi#frequency in rad/sec\n",
+ "w_3 = 100*math.pi#frequency in rad/sec\n",
+ "\n",
+ "#calculations\n",
+ "f_1 = w_1/(2*math.pi)#frequency in hertz\n",
+ "f_2 = w_2/(2*math.pi)#frequency in hertz\n",
+ "f_3 = w_3/(2*math.pi)#frequency in hertz\n",
+ "if f_1 > f_2 and f_1> f_3:\n",
+ " f_max = f_1\n",
+ "elif f_2 > f_1 and f_2> f_3:\n",
+ " f_max = f_2\n",
+ "elif f_3 > f_1 and f_3> f_2:\n",
+ " f_max = f_3\n",
+ "\n",
+ "f_s = 2*f_max;#nyquist rate\n",
+ "\n",
+ "#results\n",
+ "print \"Nyquist rate for a continuous signal (Hz) = \",f_s\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Nyquist rate for a continuous signal (Hz) = 300.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Analog_and_digital_communication_by_S_Sharma/Chapter8.ipynb b/Analog_and_digital_communication_by_S_Sharma/Chapter8.ipynb
new file mode 100755
index 00000000..ada93f19
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/Chapter8.ipynb
@@ -0,0 +1,737 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:40e21dfb7d9d57e8191a618fb51fc2251d54b9cc53424ce90fa65f1447f5fe95"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 8 - Waveform coding techniques"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2 - pg 386"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the transmission bandwidth and final bit rate\n",
+ "import math\n",
+ "from math import log10\n",
+ "#given\n",
+ "f_m = 4.2*10**6#bandwidth of television signal\n",
+ "q = 512. #quantization levels\n",
+ "\n",
+ "#calculations\n",
+ "#number of bits and quantization levels are related in binary PCM as q = 2^v \n",
+ "#where v is code word length\n",
+ "v = (log10(q)/log10(2));#code word length\n",
+ "BW = v*f_m#transmission channel bandwidth which is greater than or equal to obtained value\n",
+ "f_s = 2*f_m#sampling frequency which is greater than or equal to obtained value\n",
+ "r = v*f_s#signaling rate of final bit rate\n",
+ "SbyN_dB = 4.8 + 6*v#output signal to noise ratio which is less than or equal to obtained value\n",
+ "\n",
+ "#results\n",
+ "print \"i. Code word length (bits) = \",v\n",
+ "print \"ii. Transmission bandwidth (MHz) = \",round(BW/10**6,1)\n",
+ "print \"iii.Final bit rate (bits/sec) = \",r\n",
+ "print \"iv.Output signal to quantization noise ratio (dB) = \",SbyN_dB\n",
+ "print \"Note:There is misprint in the question i.e TV signal bandwidth \"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i. Code word length (bits) = 9.0\n",
+ "ii. Transmission bandwidth (MHz) = 37.8\n",
+ "iii.Final bit rate (bits/sec) = 75600000.0\n",
+ "iv.Output signal to quantization noise ratio (dB) = 58.8\n",
+ "Note:There is misprint in the question i.e TV signal bandwidth \n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 3 - pg 387"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the number of bits required, bandwidth required and signalling rate\n",
+ "import math\n",
+ "#given\n",
+ "f_m = 4.*10**3#maximum frequency or bans\n",
+ "x_max = 3.8#maximun input signal\n",
+ "P = 30.*10**-3#average power of signal\n",
+ "SbyN_dB= 20.#signal to noise ratio in db\n",
+ "\n",
+ "#calculations\n",
+ "SbyN = math.exp((SbyN_dB/10)*math.log(10));\n",
+ "v = round((math.log10((SbyN*(x_max)**2)/(3*P))/math.log10(2.)/2.));#number of bits required per sample\n",
+ "BW = 30*v*f_m#transmission channel bandwidth which is greater than or equal to obtained value\n",
+ "r=BW*2#wkt signalling rate is two times the transmission bandwidth\n",
+ "\n",
+ "#resulta\n",
+ "print \"i.Number of bits required (bits) = \",round(v,2)\n",
+ "print \"ii.Bandwidth required for 30 PCM coders (kHz) = \",round(BW/1000.,0)\n",
+ "print \"iii.Signalling rate (bitspersecond) = \",round(r/1000.,0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Number of bits required (bits) = 7.0\n",
+ "ii.Bandwidth required for 30 PCM coders (kHz) = 840.0\n",
+ "iii.Signalling rate (bitspersecond) = 1680.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4 - pg 388"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the minumum sampling rate and minumum bit rate required\n",
+ "import math\n",
+ "#given\n",
+ "e_max = .001#maximum quantization error\n",
+ "x_max = 10.#maximum amplitude\n",
+ "x_min = -10.#minumum amplitude\n",
+ "f_m = 100.#bandwidth of ;input signal\n",
+ "\n",
+ "#calculations\n",
+ "delta = 2*e_max#step size\n",
+ "q = (2*x_max)/delta#quantization levels\n",
+ "f_s = 2*f_m#sampling frequency\n",
+ "v = math.ceil(math.log10(q) /math.log10(2));#number of bits in the PCM word\n",
+ "r = v * f_s#bit rate required in the PCM signal which is greater than or equal to obtained value\n",
+ "BW = .5*r#transmission channel bandwidth which is greater than or equal to obtained value\n",
+ "\n",
+ "#results\n",
+ "print \"i.Minimum sampling rate required (Hz) = \",f_s\n",
+ "print \"ii.Number of bits in each PCM word (bits) = \",round(v,2)\n",
+ "print \"iii.Minimum bit rate required in the PCM signal (bits/sec) = \",round(r,0)\n",
+ "print \"iv.Transmission bandwidth (Hz) = \",round(BW,0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Minimum sampling rate required (Hz) = 200.0\n",
+ "ii.Number of bits in each PCM word (bits) = 14.0\n",
+ "iii.Minimum bit rate required in the PCM signal (bits/sec) = 2800.0\n",
+ "iv.Transmission bandwidth (Hz) = 1400.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 5 - pg 389"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the transmission bandwidth and sampling frequency\n",
+ "#given\n",
+ "f_m = 3.4*10**3#maximum frequency in the signal\n",
+ "N =24.#number of voice signals\n",
+ "r = 1.5*10**6#signaling rate\n",
+ "v = 8.#bits of encoder\n",
+ "\n",
+ "#calculations\n",
+ "BW = N * f_m#transmission bandwidth\n",
+ "r_1 = r/N#bit rate for one channel\n",
+ "f_s = r_1/v#sampling frquency\n",
+ "\n",
+ "#results\n",
+ "print \"i.Transmission bandwidth (kHz) = \",BW/1000.\n",
+ "print \"ii.Sampling frequency (Hz or samples per second) = \",f_s\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Transmission bandwidth (kHz) = 81.6\n",
+ "ii.Sampling frequency (Hz or samples per second) = 7812.5\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 6 - pg 389"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the maximum message bandwidth and signal to noise ratio\n",
+ "\n",
+ "#given\n",
+ "v = 7.#bits of encoder\n",
+ "r = 50.*10**6#bit rate of the system\n",
+ "\n",
+ "#calculations\n",
+ "f_m = r/(2*v)#maximum message bandwidth which is less than or equal to obtained value\n",
+ "SbyN_dB = 1.8 + 6*v#signal to noise ratio in dB\n",
+ "\n",
+ "#results\n",
+ "print \"i.Maximum message bandwidth (Hz) = \",round(f_m/10**6,2)\n",
+ "print \"ii.Signal to noise ratio when modulating frquency is 1MHz applied (dB) = \",SbyN_dB\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Maximum message bandwidth (Hz) = 3.57\n",
+ "ii.Signal to noise ratio when modulating frquency is 1MHz applied (dB) = 43.8\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 7 - pg 390"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the Minimum sampling rate and bit transmission rate\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "f_m = 3*10**3#maximum frequency\n",
+ "M = 16.#number of quantization levels\n",
+ "q = M #number of quantization levels\n",
+ "\n",
+ "#calculations\n",
+ "v = log(q)/log(2);#number of bits\n",
+ "f_s = 2*f_m#sampling frequency or rate which is greater than or equal to obtained value\n",
+ "r = v*f_s#bit transmission rate which is greater than or equal to obtained value\n",
+ "\n",
+ "#results\n",
+ "print \"i.Number of bits in a codeword (bits) = \",v\n",
+ "print \"ii.Minimum sampling rate (kHz) = \",f_s/1000.\n",
+ "print \"iii.Bit transmission rate (bits/sec) = \",r\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Number of bits in a codeword (bits) = 4.0\n",
+ "ii.Minimum sampling rate (kHz) = 6.0\n",
+ "iii.Bit transmission rate (bits/sec) = 24000.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 8 - pg 391"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the signal to noise ratio\n",
+ "import math\n",
+ "from math import log10\n",
+ "#given\n",
+ "f_m = 3.5*10**3#maximum frequency\n",
+ "r = 50*10**3#bit rate \n",
+ "v_rms = .2#rms value of input signal\n",
+ "R = 1#resistance\n",
+ "x_max = 2#maximum peak voltage\n",
+ "\n",
+ "#calculations\n",
+ "f_s = 2*f_m;#sampling frequency\n",
+ "v = math.ceil(r/f_s);#number of bits\n",
+ "P = v_rms**2 / R#Normalized signal power\n",
+ "SbyN = ((3*P) * 2**(2*v)) /(x_max**2);#signal to noise ratio\n",
+ "SbyN_dB = 10*log10(SbyN)#signal to noise ratio in dB\n",
+ "\n",
+ "#results\n",
+ "print \"i.Signal to noise ratio in dB = \",round(SbyN_dB,0)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Signal to noise ratio in dB = 33.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 10 - pg 392"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the signal to noise ratio and number of bits needed\n",
+ "import math\n",
+ "#given\n",
+ "#x(t) = 3*cos(500*%pi*t)\n",
+ "v = 10.#number of bits\n",
+ "A_m = 3.#peak voltage\n",
+ "SbyN_2 = 40.#signal to noise to noise ratio in second condition\n",
+ "\n",
+ "#calculations\n",
+ "SbyN = 1.8 +6*v#signal to noise ratio in dB\n",
+ "v_2 = (40 - 1.8)/6#number of bits needed for SbyN = 40\n",
+ "\n",
+ "#results\n",
+ "print \"i.Signal to noise to ratio in dB \",SbyN\n",
+ "print \"ii.Number of bits needed for noise ratio 40 (bits) = \",math.ceil(v_2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Signal to noise to ratio in dB 61.8\n",
+ "ii.Number of bits needed for noise ratio 40 (bits) = 7.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 11 - pg 393"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the maximum frequency\n",
+ "\n",
+ "#given\n",
+ "v = 7.#number of bits\n",
+ "r = 56*10**3#signaling rate\n",
+ "\n",
+ "#calculations\n",
+ "SbyN = 1.8 +6*v#signal to noise ratio in dB\n",
+ "f_s = r/v#sampling frequency\n",
+ "f_m = f_s/2#maximum frequency which is less than or equal to obtained value\n",
+ "\n",
+ "#results\n",
+ "print \"Maximum frequency (Hz) = \",f_m\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum frequency (Hz) = 4000.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 13 - pg 404"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the maximum amplitude\n",
+ "import math\n",
+ "#given\n",
+ "f_m = 3.*10**3#bandwidth or maximum frequency\n",
+ "n = 5.#system operation times\n",
+ "delta = 250.*10**-3#step size in volts\n",
+ "f_m1 = 2.*10**3#given maximum frequency to calculate amplitude\n",
+ "\n",
+ "#calculations\n",
+ "NR = 2 * f_m#nyquist rate\n",
+ "f_s = n * NR#sampling frequency\n",
+ "T_s = 1/f_s#sampling interval\n",
+ "A_m =(delta/(2 * math.pi * f_m1* T_s))#Maximum amplitude\n",
+ "\n",
+ "#result\n",
+ "print \"Maximum amplitude for 2KHz input sinusoid (V) = \",round(A_m,1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum amplitude for 2KHz input sinusoid (V) = 0.6\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 14 - pg 406"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the signalling rate\n",
+ "import math\n",
+ "from math import log\n",
+ "#given\n",
+ "f_s = 8*10**3#sampling rate\n",
+ "q = 64.#quantization levels\n",
+ "delta = 31.25#step size\n",
+ "\n",
+ "#calculations\n",
+ "v = log(q)/log(2);#no fo bits in the PC\n",
+ "f_s= (2*math.pi*3*10**3)/delta#signalling rate which should be greater than the obtaining value\n",
+ "\n",
+ "#results\n",
+ "print \"Signalling rate (kHz) = \",round(f_s,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Signalling rate (kHz) = 603.19\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15 - pg 407"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the signal to noise ratio\n",
+ "import math\n",
+ "#given\n",
+ "f_m = 2.*10**3#maximum frequency\n",
+ "f_s = 64.*10**3#sampling frequency\n",
+ "f_M = 4.*10**3#cut off frequency of low pass filter\n",
+ "\n",
+ "#calculation\n",
+ "SNR_0 = (3 * f_s**3) /(8 * math.pi**2 * f_m**2 * f_M);#signal to noise ratio of linear delta modulation system\n",
+ "SNR_dB = 10*math.log10(SNR_0);#SNR in dB\n",
+ "\n",
+ "#result\n",
+ "print \"Signal to noise ratio of linear delta modulation system (dB) = \",round(SNR_dB,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Signal to noise ratio of linear delta modulation system (dB) = 27.94\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 16 - pg 407"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the signal to noise ratio\n",
+ "\n",
+ "#given\n",
+ "r = 64.*10**3#data rate\n",
+ "f_s = 8.*10**3#sampling frequency\n",
+ "N = 8.#number of samples\n",
+ "\n",
+ "#calcualtion\n",
+ "SNR_q = 1.8 + 6*N#signal to noise ratio\n",
+ "\n",
+ "#result\n",
+ "print \"Signla to noise ratio (dB) = \",SNR_q\n",
+ "print \"The SNR of a DM system is 27.94dB which is too poor as \\ncompared to 49.8db of an 8 bit PCM system. Thus, for all\\n the simplicity of Dm,it cannot perform as well as an\\n 8 bit PCM\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Signla to noise ratio (dB) = 49.8\n",
+ "The SNR of a DM system is 27.94dB which is too poor as \n",
+ "compared to 49.8db of an 8 bit PCM system. Thus, for all\n",
+ " the simplicity of Dm,it cannot perform as well as an\n",
+ " 8 bit PCM\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 17 - pg 413"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the sampling frequency and quantizing level\n",
+ "import math\n",
+ "#given\n",
+ "r = 36000.#bit rate of a channel\n",
+ "f_m = 3.2*10**3#maximum frequency\n",
+ "\n",
+ "#calculations\n",
+ "f_s = 2*f_m#sampling frequency\n",
+ "v = math.floor(r/f_s)#number of binary digits\n",
+ "q = 2**v#quantizing level\n",
+ "f_s2=r/v\n",
+ "#results\n",
+ "print \"i.Sampling frequency (Hz) = \",f_s\n",
+ "print \"ii.Number of binary digits = \",round(v,1)\n",
+ "print \"iii.Quantizing level = \",round(q,0)\n",
+ "print \"iv. Sampling rate (Hz) = \",f_s2"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.Sampling frequency (Hz) = 6400.0\n",
+ "ii.Number of binary digits = 5.0\n",
+ "iii.Quantizing level = 32.0\n",
+ "iv. Sampling rate (Hz) = 7200.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 20 - pg 415"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the number of required levels and output signal to quantizing noise ratio\n",
+ "import math\n",
+ "from math import log, exp, sqrt\n",
+ "#given\n",
+ "SbyN_0dB = 40.#signal to noise ratio in dB\n",
+ "SbyN_0 = exp((SbyN_0dB/10)*log(10))#signal to noise ratio\n",
+ "q = sqrt((2. / 3) * (SbyN_0));#quantizing level\n",
+ "v = math.ceil(log(q)/log(2.))#number of binary bits\n",
+ "q_1 = 2**v#number of levels required \n",
+ "SbyN_dB1 = 1.76 + 6.02*v#output signal-to-quantizing noise ratio in dB\n",
+ "\n",
+ "#results\n",
+ "print \"Number of required levels = \",v\n",
+ "print \"Output signal-to-quantizing noise ratio (dB) = \",SbyN_dB1\n",
+ "print \"Note : In the textbook they took number of levels as approximation so we get change\\n in SbyN\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Number of required levels = 7.0\n",
+ "Output signal-to-quantizing noise ratio (dB) = 43.9\n",
+ "Note : In the textbook they took number of levels as approximation so we get change\n",
+ " in SbyN\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21 - pg 416"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#calculate the minimum number of quantizing levels and bits, bandwidth required\n",
+ "import math\n",
+ "from math import log,exp,sqrt\n",
+ "#given\n",
+ "SbyN_dB = 30.#signal to noise ratio\n",
+ "f_s = 8000.#sampling rate\n",
+ "\n",
+ "#calculations\n",
+ "#for Sbyn_dB = 1.76 + 20*logq\n",
+ "x1 = (1./ 20)*(SbyN_dB - 1.76)\n",
+ "q1 = exp(x1*log(10))#quantizing level for first case\n",
+ "v1 = math.ceil(log(q1)/log(2))# number of bits for first case\n",
+ "f_PCM1 = (v1 / 2) * f_s#minimum required bandwidth for first case\n",
+ "#for SbyN = 20logq - 10.1\n",
+ "x2 = (1./20) * (SbyN_dB + 10.1)\n",
+ "q2 = exp(x2*log(10))#quantizing level for second case\n",
+ "v2 = math.ceil(log(q2)/log(2))# number of bits for second case\n",
+ "f_PCM2 = (v2 / 2) * f_s#minimum required bandwidth for second case\n",
+ "\n",
+ "#results\n",
+ "print \"i.a.Minimum number of quantizing levels for first case = \",round(q1,2)\n",
+ "print \" b.Number of bits for first case = \",v1\n",
+ "print \" c.Minimum system bandwidth required for first case (kHz) = \",f_PCM1/1000.\n",
+ "print \"ii.a.Minimum number of quantizing levels for second case = \",round(q2,1)\n",
+ "print \" b.Number of bits for second case = \",v2\n",
+ "print \" c.Minimum system bandwidth required for second case (kHz) = \",f_PCM2/1000.\n",
+ "print \"Note:In the text book they took approximation in\\nquantization levels and number bits\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i.a.Minimum number of quantizing levels for first case = 25.82\n",
+ " b.Number of bits for first case = 5.0\n",
+ " c.Minimum system bandwidth required for first case (kHz) = 20.0\n",
+ "ii.a.Minimum number of quantizing levels for second case = 101.2\n",
+ " b.Number of bits for second case = 7.0\n",
+ " c.Minimum system bandwidth required for second case (kHz) = 28.0\n",
+ "Note:In the text book they took approximation in\n",
+ "quantization levels and number bits\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Analog_and_digital_communication_by_S_Sharma/README.txt b/Analog_and_digital_communication_by_S_Sharma/README.txt
new file mode 100755
index 00000000..f52726d2
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/README.txt
@@ -0,0 +1,10 @@
+Contributed By: Chaitanya Potti
+Course: btech
+College/Institute/Organization: IITB
+Department/Designation: Chemical engineering
+Book Title: Analog and digital communication
+Author: S Sharma
+Publisher: S. K. Kataria & Sons, New Delhi
+Year of publication: 2012
+Isbn: 81-89757-52-0
+Edition: 3 \ No newline at end of file
diff --git a/Analog_and_digital_communication_by_S_Sharma/screenshots/chap11.png b/Analog_and_digital_communication_by_S_Sharma/screenshots/chap11.png
new file mode 100755
index 00000000..eff19bc9
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/screenshots/chap11.png
Binary files differ
diff --git a/Analog_and_digital_communication_by_S_Sharma/screenshots/chap2.png b/Analog_and_digital_communication_by_S_Sharma/screenshots/chap2.png
new file mode 100755
index 00000000..37fb56bb
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/screenshots/chap2.png
Binary files differ
diff --git a/Analog_and_digital_communication_by_S_Sharma/screenshots/chap3.png b/Analog_and_digital_communication_by_S_Sharma/screenshots/chap3.png
new file mode 100755
index 00000000..aa1f2541
--- /dev/null
+++ b/Analog_and_digital_communication_by_S_Sharma/screenshots/chap3.png
Binary files differ