summaryrefslogtreecommitdiff
path: root/Electronic_Communication_Systems_by_Roy_Blake/Chapter13.ipynb
blob: f9def02b2ea564177a9ec57ad55951940364d20e (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 13 : Multiplexing and Multiple Access Techniques"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1 : pg 437"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a)The number of signals are  250.0\n",
      "b)The number of signals are  125.0\n",
      "c)The number of signals are  6.0\n",
      "d)The number of signals are  71.0\n"
     ]
    }
   ],
   "source": [
    " \n",
    "# page no 437\n",
    "# prob no 13_1\n",
    "#calculate the no. of signals in all cases\n",
    "from math  import log\n",
    "#given\n",
    "freq_band=1.*10**6;\n",
    "# A)For SSBSC AM, the bandwidth is the same as the maximunm modulating freq.\n",
    "fmax=4.*10**3;\n",
    "#calculations and results\n",
    "B=fmax;\n",
    "no_of_signal=freq_band/B;\n",
    "print 'a)The number of signals are ',no_of_signal\n",
    "# B)For DSB AM, the bandwidth is twice the maximunm modulating freq.\n",
    "B=2*fmax;\n",
    "no_of_signal=freq_band/B;\n",
    "print 'b)The number of signals are ',no_of_signal\n",
    "# C)Using Carson's Rule to approximate the bandwidth\n",
    "f_max=15.*10**3; deviation=75.*10**3;\n",
    "B=2*(deviation + f_max);\n",
    "no_of_signal=freq_band/B;\n",
    "print 'c)The number of signals are ',round(no_of_signal)\n",
    "# D)Use Shannon-Hartley theorem to find the bandwidth\n",
    "C=56.*10**3;M=4.;#for QPSK\n",
    "B=C/(2*log(M) /log(2));\n",
    "no_of_signal=freq_band/B;\n",
    "print 'd)The number of signals are ',round(no_of_signal)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2 : pg 444"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The noise power at BW=30 kHz is -129.059 dBm\n",
      "The noise power at BW=10 MHz is -103.83 dBm\n",
      "The value of SNR for BW=30 kHz is 19.059 dB\n",
      "The value of SNR for BW=10 MHz is -6.17 dB\n"
     ]
    }
   ],
   "source": [
    " \n",
    "# page no 444\n",
    "# prob no 13_2\n",
    "#calculate the value of SNR and noise power in both cases\n",
    "#Voice transmisssion occupies 30 kHz.Spread spectrum is used to increase BW to 10MHz\n",
    "from math import log10\n",
    "#given\n",
    "B1=30.*10**3;#BW is 30 kHz\n",
    "B2=10.*10**6;#BW is 10 MHz\n",
    "T=300.;#noise temp at i/p\n",
    "PN=-110.;#signal has total signal power of -110 dBm at receiver\n",
    "k=1.38*10**-23;#Boltzmann's const in J/K\n",
    "#calculations and results\n",
    "#Determination of noise power at B1=30kHz\n",
    "PN1=10*(log10(k*B1*T/10**-3));\n",
    "print 'The noise power at BW=30 kHz is',round(PN1,3),'dBm'\n",
    "#Determination of noise power at B2=10MHz\n",
    "PN2=10*(log10(k*B2*T/10**-3));\n",
    "print 'The noise power at BW=10 MHz is',round(PN2,3),'dBm'\n",
    "#Determination of SNR for 30kHz BW\n",
    "SNR1=PN-PN1;\n",
    "print 'The value of SNR for BW=30 kHz is',round(SNR1,3),'dB'\n",
    "#Determination of SNR for 10MHz BW\n",
    "SNR2=PN-PN2;\n",
    "print 'The value of SNR for BW=10 MHz is',round(SNR2,3),'dB'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3 : pg 445"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time required for each freq 0.1 sec/hop\n"
     ]
    }
   ],
   "source": [
    " \n",
    "# page no 445\n",
    "# prob no 13_3\n",
    "#calculate the time required\n",
    "#given\n",
    "no_of_freq_hops =100.; total_time_req=10.;\n",
    "#calculations\n",
    "time_for_each_freq = total_time_req  / no_of_freq_hops;\n",
    "#results\n",
    "print 'Time required for each freq',time_for_each_freq,'sec/hop'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4 : pg 446"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The no of signal changes i.e. symbol rate is  80000.0 baud\n"
     ]
    }
   ],
   "source": [
    " \n",
    "# page no 446\n",
    "# prob no 13_4\n",
    "#calculate the no. of signal changes\n",
    "from math import log\n",
    "#given\n",
    "bit_rate=16.*10**3;#in bps\n",
    "#chip_rate =10:1;\n",
    "no_of_chip=10.;\n",
    "#calculations\n",
    "total_bit_rate=no_of_chip*bit_rate;\n",
    "m=4;n=log(m)/log(2);\n",
    "symbol_rate = total_bit_rate/n;\n",
    "#results\n",
    "print 'The no of signal changes i.e. symbol rate is ',symbol_rate,'baud'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5 : pg 447"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The value of BW after spreading 10.0 MHz\n",
      "The value of processing gain 16.99 dB\n",
      "The value of SNR after spreading in dB 3.01 dB\n"
     ]
    }
   ],
   "source": [
    " \n",
    "# page no 447\n",
    "# prob no 13_5\n",
    "#calculate the value of BW, SNR\n",
    "#signal with bandwidth Bbb=200 kHz & SNR=20 dB spred at chip rate 50:1\n",
    "from math import log10\n",
    "#given\n",
    "Bbb=200.*10**3;#Bandwidth\n",
    "Gp=50.;#chip rate\n",
    "SNR_in=20.;#SNR is 20 dB without spreading\n",
    "#calculations and results\n",
    "#Determination of BW after spreading\n",
    "Brf=Gp*Bbb;\n",
    "print 'The value of BW after spreading',Brf/10**6,'MHz'\n",
    "#Converting into dB \n",
    "Gp_dB=10*log10(Gp);\n",
    "print 'The value of processing gain',round(Gp_dB,3),'dB'\n",
    "#Determination of SNR after spreadng\n",
    "SNR_out=SNR_in-Gp_dB;\n",
    "print 'The value of SNR after spreading in dB',round(SNR_out,3),'dB'"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}