summaryrefslogtreecommitdiff
path: root/sample_notebooks/MohdAkhlak/ch3.ipynb
blob: 82035c0dbf7b18ddd62cb50825667947159c8860 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:931ccf820f91dc3bd263fe2430c73233b66e02ab90eedbd3236bc42b5727ead5"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3, Waveform generators"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 1 - page : 145"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data \n",
      "\n",
      "R2 = 100.0  # ohm\n",
      "R1 = 50.0*10**3  # ohm\n",
      "Vref = 0  # V\n",
      "vi = 1  # V\n",
      "Vsat = 14.0   # V\n",
      "# Solution \n",
      "\n",
      "VUT = (R2*Vsat)/(R1+R2)  # V\n",
      "VLT = (R2*-Vsat)/(R1+R2) # V\n",
      "\n",
      "# Displaying the values\n",
      "\n",
      "print \"The value of Upper threshold voltage =  \",int(round(VUT*10**3,0)),\"mV\"\n",
      "print \"The value of Lower threshold voltage = \",int(round(VLT*10**3,0)),\"mV\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Upper threshold voltage =   28 mV\n",
        "The value of Lower threshold voltage =  -28 mV\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 2 - page : 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np \n",
      "# Given data\n",
      "\n",
      "VUT = 0\n",
      "VH = 0.3\n",
      "f = 10.0**3\n",
      "# Solution \n",
      "\n",
      "VLT = VUT - VH\n",
      "theta = round(np.arcsin(VH/2),1)\n",
      "T = 1/f\n",
      "Ttheta = theta/(2*np.pi*f) \n",
      "T1 = (T/2) + Ttheta\n",
      "T2 = (T/2) - Ttheta \n",
      "\n",
      "# Displayig the values \n",
      "\n",
      "print \"The value of Lower threshold voltage = \",VLT,\"V\"\n",
      "print \"The value of angle theta             = \",theta,\"Radian\"\n",
      "print \"The value of T1                      = \",round(T1*10**3,3),\"ms\"\n",
      "print \"The value of T2                      = \",round(T2*10**3,3),\"ms\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Lower threshold voltage =  -0.3 V\n",
        "The value of angle theta             =  0.2 Radian\n",
        "The value of T1                      =  0.532 ms\n",
        "The value of T2                      =  0.468 ms\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 3 - page : 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "# Given data \n",
      "\n",
      "f = 100\n",
      "C = 0.1*10**-6\n",
      "\n",
      "# Solution \n",
      "\n",
      "R = 1/(math.sqrt(6)*2*math.pi*(10**-7)*100)\n",
      "R1 = 10*R\n",
      "Rf = 29*R1\n",
      "\n",
      "# Displaying the solutions \n",
      "\n",
      "print \"The value of R1 =\",int(round(R1*10**-3,0)),\"Kilo Ohms\"\n",
      "print \"The value of Rf =\",int(round(Rf*10**-3,0)),\"Kilo Ohms\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R1 = 65 Kilo Ohms\n",
        "The value of Rf = 1884 Kilo Ohms\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 4 - page 158"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "# Given data \n",
      "\n",
      "f = 50\n",
      "C = 0.2*10**-6\n",
      "\n",
      "# Solution \n",
      "\n",
      "R = 1/(math.sqrt(6)*2*math.pi*(10**-7)*100)\n",
      "R1 = 10*R\n",
      "Rf = 29*R1\n",
      "\n",
      "# Displaying the solutions \n",
      "\n",
      "print \"The value of R1 is %0.2f kohms\"%(R1*10**-3)\n",
      "print \"The value of Rf is %0.2f kohms\"%(Rf*10**-3)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R1 is 64.97 kohms\n",
        "The value of Rf is 1884.27 kohms\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 5 - page 162"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi, arcsin \n",
      "# Given data\n",
      "\n",
      "VUT = 0\n",
      "VH = 0.5\n",
      "f = 1000\n",
      "# Solution \n",
      "\n",
      "VLT = VUT - VH\n",
      "theta = round(arcsin(VH/2),1)\n",
      "T = 1/f\n",
      "Ttheta = theta/(2*pi*f) \n",
      "T1 = (T/2) + Ttheta\n",
      "T2 = (T/2) - Ttheta \n",
      "\n",
      "# Displayig the values \n",
      "\n",
      "print \"The value of Lower threshold voltage = \",VLT,\"V\"\n",
      "print \"The value of angle theta             = \",theta,\"Radian\"\n",
      "print \"The value of T1                      = \",round(T1*10**3,3),\"ms\"\n",
      "print \"The value of T2                      = \",round(T2*10**3,3),\"ms\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Lower threshold voltage =  -0.5 V\n",
        "The value of angle theta             =  0.3 Radian\n",
        "The value of T1                      =  0.048 ms\n",
        "The value of T2                      =  -0.048 ms\n"
       ]
      }
     ],
     "prompt_number": 29
    }
   ],
   "metadata": {}
  }
 ]
}