diff options
Diffstat (limited to 'Digital_Communications_by_S._Sharma/Chapter2.ipynb')
-rwxr-xr-x | Digital_Communications_by_S._Sharma/Chapter2.ipynb | 290 |
1 files changed, 290 insertions, 0 deletions
diff --git a/Digital_Communications_by_S._Sharma/Chapter2.ipynb b/Digital_Communications_by_S._Sharma/Chapter2.ipynb new file mode 100755 index 00000000..9cc6d1df --- /dev/null +++ b/Digital_Communications_by_S._Sharma/Chapter2.ipynb @@ -0,0 +1,290 @@ +{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h1>Chapter 2: SAMPLING THEORY AND PULSE MODULATION<h1>"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.1, page no 50"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#find Nquist Rate\n",
+ "\n",
+ "#Variable declaration\n",
+ "#given \n",
+ "pi=3.14\n",
+ "w1=50*pi\n",
+ "w2=300*pi\n",
+ "w3=100*pi\n",
+ "#w=2*%pi*f\n",
+ "\n",
+ "#Calculation\n",
+ "f1=w1/(2*pi)\n",
+ "f2=w2/(2*pi)\n",
+ "f3=w3/(2*pi)\n",
+ "fm=f2 #fm = maximum frquency is present at the signal\n",
+ "\n",
+ "#Result\n",
+ "print('maximum frquency of the signal is = %.2f Hz' %f2)\n",
+ "fs=2*fm #Nyquist rate\n",
+ "print('Nquist Rate of Signal is = %.2f Hz' %fs)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "maximum frquency of the signal is = 150.00 Hz\n",
+ "Nquist Rate of Signal is = 300.00 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.2 , page no 50"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#Find Nquist Rate and Nquist time interval\n",
+ "\n",
+ "#Variable declaration\n",
+ "#given\n",
+ "w1=5000*math.pi\n",
+ "w2=3000*math.pi;\n",
+ "f1=w1/(2*math.pi);\n",
+ "f2=w2/(2*math.pi);\n",
+ "\n",
+ "#Calculation\n",
+ "fm=f1 #fm = maximum frquency is present at the signal\n",
+ "fs=2*fm #Nyquist rate\n",
+ "Ts=1.0/(2.0*fm) #frequncy =1/time\n",
+ "Ts=Ts*(10**3)\n",
+ "\n",
+ "#Result\n",
+ "print('maximum frquency of the signal is = %.f Hz' %f1)\n",
+ "print('Nquist Rate of the given Signal is = %.f Hz' %fs)\n",
+ "print('Nquist Interval of the given signal is = %.1f m Sec' %Ts)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "maximum frquency of the signal is = 2500 Hz\n",
+ "Nquist Rate of the given Signal is = 5000 Hz\n",
+ "Nquist Interval of the given signal is = 0.2 m Sec\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.3, page no 51"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Find Nquist Rate \n",
+ "\n",
+ "#Variable declaration\n",
+ "#given\n",
+ "f=100.0 # Frequency component of continuous-time signal\n",
+ "\n",
+ "#Calculation\n",
+ "fs=2*f #Nyquist rate\n",
+ "\n",
+ "#Result\n",
+ "print('i) To avoid aliasing Nquist Rate is = %.f Hz' %fs)\n",
+ "print('ii) It is theoretical example ')\n",
+ "print('iii) It is theoretical example ')\n",
+ "print('iv) It is theoretical example ')\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i) To avoid aliasing Nquist Rate is = 200 Hz\n",
+ "ii) It is theoretical example \n",
+ "iii) It is theoretical example \n",
+ "iv) It is theoretical example \n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.4, page no 52 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "#Find Nquist Rate of Continous signal\n",
+ "\n",
+ "#Variable declaration\n",
+ "#given\n",
+ "w1=50*math.pi\n",
+ "w2=300*math.pi\n",
+ "w3=100*math.pi\n",
+ "\n",
+ "#Calculation\n",
+ "f1=w1/(2*math.pi)\n",
+ "f2=w2/(2*math.pi)\n",
+ "f3=w3/(2*math.pi)\n",
+ "fmax=f2 #fmax = Highest frquency component of the message signal\n",
+ "fs=2*fmax #Nyquist rate\n",
+ "\n",
+ "#Result\n",
+ "print('Highest frquency component of the message signal will be fmax = %.f Hz' %fmax)\n",
+ "print('Nquist Rate of the given Signal is = %.f Hz' %fs)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Highest frquency component of the message signal will be fmax = 150 Hz\n",
+ "Nquist Rate of the given Signal is = 300 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Example 2.7, page no 67 <h3>"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#find amplitude distortion at highest frquency\n",
+ "\n",
+ "#Variable declaration\n",
+ "#given\n",
+ "fs=9.5 #samplig frequncy\n",
+ "fmax=1 #maximum frequncy\n",
+ "t=0.2 #pulse width\n",
+ "\n",
+ "#Calculation\n",
+ "c=3*10**8\n",
+ "f=fmax\n",
+ "H1=t*(0.9933) #aperture effect at highest frequency, sinc(f*t)=0.9933 (given)\n",
+ "H1=H1*100\n",
+ "\n",
+ "#Result\n",
+ "print('|H(1)|=%.2f' %H1)\n",
+ "print('Approximation error')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "|H(1)|=19.87\n",
+ "Approximation error\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.8, page no 74 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Calculate Transmission Bandwidth\n",
+ "\n",
+ "#Variable declaration\n",
+ "#given\n",
+ "fm=3.0*(10^3)\n",
+ "fs=8.0*(10^3) # sampling frequncy\n",
+ "\n",
+ "#Calculation\n",
+ "Ts=1.0/fs\n",
+ "t=0.1*Ts\n",
+ "BW=1.0/(2*t) #Bandwidth\n",
+ "BW=BW/(10^3)\n",
+ "\n",
+ "#Result\n",
+ "print('Transmission Bandwidth of PAM signal is kHz = %.f Khz ' %BW)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Transmission Bandwidth of PAM signal is kHz = 40 Khz \n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |