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
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chapter 12: DIGITAL COMMUNICATIONS"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 12.13_1: example_7.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"clc;\n",
"//page no 451\n",
"//problem no 12.13.1\n",
"//A 8 bit codewords\n",
"Pbec=0.01;n=8;i=3;\n",
"Pi=(Pbec^i)*((1-(Pbec))^(n-i));\n",
"Cin=(factorial(n))/(factorial(i)*factorial(n-i));\n",
"Pin=Cin*Pi;\n",
"P_in=Cin*Pbec^i\n",
"disp(Pin,'Pin=','The probability of a received codeword');\n",
"disp(P_in,'P_in');"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 12.13_3: example_6.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"clc;\n",
"//page no 454\n",
"//problem no 12.13.3\n",
"SN_dB=9;\n",
"SNR=10^(SN_dB/10);\n",
"PbeU=1/2 * (1-erf(sqrt(SNR)));\n",
"BERu=PbeU;\n",
"disp(BERu,'a)The bit error probability');\n",
"n=10;k=n-1;\n",
"r=k/n;\n",
"SNR1=r*SNR;\n",
"PbeC=1/2 * (1-erf(sqrt(SNR1)));\n",
"BERc=(n-1)*PbeC^2;\n",
"disp(BERc,'b)The bit error probability');"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 12.13_4: example_9.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"clc;\n",
"//page no 457\n",
"//problem no 12.13.4\n",
"//Tx link \n",
"SN_dB=8;\n",
"SNR=10^(SN_dB/10);\n",
"//a)Determination of bit error rate\n",
"PbeU=0.5*(1-erf(sqrt(SNR)));\n",
"BER_U=PbeU;\n",
"disp(BER_U,'a)The bit-error rate is');\n",
"//b)new bit error rate\n",
"n=15;k=11;t=1;r=k/n;\n",
"SNR_n=r*SNR;\n",
"PbeC=0.5*(1-erf(sqrt(SNR_n)));\n",
"BER_C=((factorial(n-1))*PbeC^(t+1))/((factorial(t))*(factorial(n-t-1)));\n",
"disp(BER_C,'The new bit error rate is');"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 12.4_1: example_1.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"clc;\n",
"//page no 419\n",
"// problem no 12.4.1\n",
"//a binary polar waveform with following specifications are given\n",
"Vs_Vn=4;//SNVR\n",
"a=erf(4/sqrt(2));\n",
"b=erfc(4/sqrt(2));\n",
"Pbe=1/2 * b;// bit error probability\n",
"disp(a);\n",
"disp(b);\n",
"disp(Pbe,'The bit error probability');"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 12.4_2: example_2.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"clc;\n",
"//page no 420\n",
"//problem no 12.4.2\n",
"//a binary unipolar waveform with following specifications are given\n",
"A=4;//max value of received signal voltage\n",
"Vn=0.5;//rms noise voltage\n",
"Vth=2;//Threshold voltage for the comparator\n",
"Pbe=1/2 * b;// bit error probability\n",
"disp(Pbe,'The bit error probability');"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 12.4_3: example_3.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"clc;\n",
"//page no 421\n",
"//problem no 12.4.3\n",
"SNR=9;//SNR in dB\n",
"//conversion of dB to power ratio\n",
"p=10^(9/10);\n",
"// for Polar\n",
"Pbe1=1/2 * erfc(sqrt(7.94/2));\n",
"disp(Pbe1);\n",
"// for Unipolar\n",
"Pbe2=1/2 * erfc(sqrt(7.94)/2);\n",
"disp(Pbe2);"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 12.5_1: exampple_4.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"clc;\n",
"//page no 423\n",
"//problem no 12.5.1\n",
"// binary unipolar signal is given\n",
"Pavg=6*10^-12;//in W\n",
"d=0.02*10^-6;//pulse duration in sec\n",
"T=550;//equivalent noise temp in K\n",
"Eb=Pavg*d;//avg energy per pulse\n",
"No=1.38*10^-23 *T;\n",
"r=Eb/No;\n",
"//Bit error probability is \n",
"Pbe=1/2 * erfc(sqrt(r/2));\n",
"disp(Pbe,'The bit error probability');"
]
}
,
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 12.9_1: example_5.sce"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"clc;\n",
"//page no 435\n",
"//problem no 12.9.1\n",
"ENR=10;// energy to noise density ratio\n",
"Pbe1=1/2 * erfc(sqrt(ENR/2));\n",
"disp(Pbe1,'a)The bit error probability');\n",
"Pbe2=1/2 * %e^-(ENR/2);\n",
"disp(Pbe2,'b)The bit error probability');"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Scilab",
"language": "scilab",
"name": "scilab"
},
"language_info": {
"file_extension": ".sce",
"help_links": [
{
"text": "MetaKernel Magics",
"url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
}
],
"mimetype": "text/x-octave",
"name": "scilab",
"version": "0.7.1"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|