summaryrefslogtreecommitdiff
path: root/Analog_and_digital_communication_by_S_Sharma/Chapter4.ipynb
blob: de531ca74aa03e9877940227c5d525bd751fbafc (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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
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": {}
  }
 ]
}