summaryrefslogtreecommitdiff
path: root/sample_notebooks/MohdAsif/Chapter2,_Measurement_Errors.ipynb
blob: f8ad79f058fec7dda0d1b71ac0b2668b9987eb77 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:7b602763fd5a9c056abb62703a3bc42ae0cb4a39b3c349f78c056ebe58b1c643"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Example 2_3_1"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Precision of the 5th measurement\n",
      "#Given data : Measurements taken(Unit less)\n",
      "X1=98;\n",
      "X2=101;\n",
      "X3=102;\n",
      "X4=97;\n",
      "X5=101;\n",
      "X6=100;\n",
      "X7=103;\n",
      "X8=98;\n",
      "X9=106;\n",
      "X10=99.0;\n",
      "#Calculation\n",
      "Xn_bar=(X1+X2+X3+X4+X5+X6+X7+X8+X9+X10)/10;\n",
      "Xn=101    # value of 5th measurement\n",
      "P=(1-abs((Xn-Xn_bar)/Xn_bar))*100    #Precision\n",
      "print \"Precision of the 5th measurement,P(%) = \",round(P,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Precision of the 5th measurement,P(%) =  99.502\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Example 2_3_2_a"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Absolute error\n",
      "#given data :\n",
      "Ae=80.0    # in V\n",
      "Am=79    # in V\n",
      "e=Ae-Am    #absolute error\n",
      "print \"Absolute error,e(V) = \",e"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Absolute error,e(V) =  1.0\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Example 2_3_2_b"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Finding error\n",
      "#given data :\n",
      "Ae=80.0    # in V\n",
      "Am=79    # in V\n",
      "e=Ae-Am    #error\n",
      "ep=(e/Ae)*100    #relative percent error\n",
      "print \"Relative Percent Error(%) = \",ep"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Relative Percent Error(%) =  1.25\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Example 2_3_3"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# maximum error\n",
      "#given data :\n",
      "V1=100     # in volts\n",
      "V2=200    # in volts\n",
      "V=V2-V1   # Voltage difference\n",
      "A=.25    # Accuracy may be \u00b1 in %\n",
      "max_error=(A/100)*V    # in Volts\n",
      "print \"maximum error(V) = \u00b1\",max_error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum error(V) = \u00b1 0.25\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Example 2_3_4"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#sensitivity and deflection error\n",
      "# given data :\n",
      "C=4.0    # change in output in mm\n",
      "M=8.0    # magnitude of input in ohm\n",
      "S=C/M  # sensitivity\n",
      "print \"sensitivity,S(mm/ohm) = \",S\n",
      "D=M/C  # Deflection\n",
      "print \"Deflection factor,D(ohm/m) = \",D"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "sensitivity,S(mm/ohm) =  0.5\n",
        "Deflection factor,D(ohm/m) =  2.0\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Example 2_3_5 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Resolution\n",
      "# given data :\n",
      "V=200.0    # full scale reading in volts\n",
      "N=100.0    # number of divisions \n",
      "Scale_div=V/N    # Volts\n",
      "R=(1/10.0)*Scale_div    # Resolution in Volts\n",
      "print \"Resolution, R(V) = \",round(R,4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resolution, R(V) =  0.2\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Example 2_3_6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Resolution\n",
      "#given data :\n",
      "V=9.999    # full scale read out in volt\n",
      "c=range(0,9999)    # range from 0 to 9999\n",
      "R=(1/max(c))*V*10.0**3\n",
      "print \"Resolution, R(mV)\", R"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resolution, R(mV) 0.0\n"
       ]
      }
     ],
     "prompt_number": 29
    }
   ],
   "metadata": {}
  }
 ]
}