summaryrefslogtreecommitdiff
path: root/Digital_Communications/ChapterNo2.ipynb
blob: f8cf6b9051247e1cd381889c4a4365aaacc4de7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter no 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": {}
  }
 ]
}