summaryrefslogtreecommitdiff
path: root/Optical_Communication_by_R._S._Prasad,_Gurjit_Kaur/chapter1.ipynb
blob: a271cc5c358186800cfe11edacb78d7746edb552 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:985ad452c65fa6c321f3f5a416b2ee95d94eb6cba2ef0da1eac4d7b73a848422"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "chapter1 - Overview of optical fiber communications"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6.1, page 1-15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "Bit_rate = 2*10**9       # bit rate of channel\n",
      "# Given sequence is 010111101110\n",
      "Shortest_duration = 1*(1/Bit_rate)      # shortest duration is '1'\n",
      "Widest_duration = 4*(1/Bit_rate)      #widest duration is '1111'\n",
      "Shortest_duration = Shortest_duration        # seconds\n",
      "Widest_duration = Widest_duration      # seconds\n",
      "print \"Shortest duration is %.1g seconds.\" %Shortest_duration\n",
      "print \"Widest duration is %.1g seconds.\" %Widest_duration"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Shortest duration is 5e-10 seconds.\n",
        "Widest duration is 2e-09 seconds.\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.12.1, page 1-28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import log2\n",
      "Bandwidth = 2*10**6      #Bandwidth of channel\n",
      "Signal_to_Noise_ratio = 1               #Signal to Noise ratio of channel\n",
      "Capacity = Bandwidth * log2(1 + Signal_to_Noise_ratio)  #computing capacity\n",
      "Capacity=Capacity/10**6 \n",
      "print \"Maximum capacity of channel is %d Mb/sec.\" %Capacity"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum capacity of channel is 2 Mb/sec.\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Question 10, page 1-31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "Bit_rate = 2*10**9       # bit rate of channel\n",
      "# Given sequence is 010111101110\n",
      "Shortest_duration = 1*(1/Bit_rate)      # shortest duration is '1'\n",
      "Widest_duration = 4*(1/Bit_rate)      #widest duration is '1111'\n",
      "Shortest_duration = Shortest_duration        # seconds\n",
      "Widest_duration = Widest_duration      # seconds\n",
      "print \"Shortest duration is %.1g seconds.\" %Shortest_duration\n",
      "print \"Widest duration is %.1g seconds.\" %Widest_duration"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Shortest duration is 5e-10 seconds.\n",
        "Widest duration is 2e-09 seconds.\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}