summaryrefslogtreecommitdiff
path: root/Electronic_Instrumentation_and_Measurements_by_David_A._Bell/Chapter2.ipynb
diff options
context:
space:
mode:
authorThomas Stephen Lee2015-08-28 16:53:23 +0530
committerThomas Stephen Lee2015-08-28 16:53:23 +0530
commit4a1f703f1c1808d390ebf80e80659fe161f69fab (patch)
tree31b43ae8895599f2d13cf19395d84164463615d9 /Electronic_Instrumentation_and_Measurements_by_David_A._Bell/Chapter2.ipynb
parent9d260e6fae7328d816a514130b691fbd0e9ef81d (diff)
downloadPython-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.tar.gz
Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.tar.bz2
Python-Textbook-Companions-4a1f703f1c1808d390ebf80e80659fe161f69fab.zip
add books
Diffstat (limited to 'Electronic_Instrumentation_and_Measurements_by_David_A._Bell/Chapter2.ipynb')
-rw-r--r--Electronic_Instrumentation_and_Measurements_by_David_A._Bell/Chapter2.ipynb365
1 files changed, 365 insertions, 0 deletions
diff --git a/Electronic_Instrumentation_and_Measurements_by_David_A._Bell/Chapter2.ipynb b/Electronic_Instrumentation_and_Measurements_by_David_A._Bell/Chapter2.ipynb
new file mode 100644
index 00000000..6bbb77b6
--- /dev/null
+++ b/Electronic_Instrumentation_and_Measurements_by_David_A._Bell/Chapter2.ipynb
@@ -0,0 +1,365 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# CHAPTER 2: MEASUREMENT ERRORS \n",
+ "\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example 2-1, Page Number: 16"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Tolerance of the resistance= ± 5 %\n",
+ "Maximum Resistance at 75 degree celsius= 1.2915 kilo ohm\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Variable Declaration\n",
+ "\n",
+ "#Resistance Values at 25 degree Celsius\n",
+ "rmax25=1.26*10**3 #in ohm\n",
+ "rmin25=1.14*10**3 #in ohm\n",
+ "r=1.2*10**3 #in ohm\n",
+ "ppm=500.0/1000000 \n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "absolute_error=rmax25-r #in ohm \n",
+ "\n",
+ "#Tolerance value in percentage\n",
+ "tolerance=absolute_error/r*100 #percentage\n",
+ "\n",
+ "#Resistance per degree Celsius\n",
+ "rperc=rmax25*ppm\n",
+ "\n",
+ "\n",
+ "#To Calculate ressistance at 75 degree celsius\n",
+ "\n",
+ "dT=75-25 #degree celsius\n",
+ "\n",
+ "dR=rperc*dT #in ohm \n",
+ "\n",
+ "#Maximum resistance at 75 degree celsius\n",
+ "\n",
+ "rmax75=rmax25+dR #in ohm \n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print 'Tolerance of the resistance= ±',int(tolerance),'%'\n",
+ "print 'Maximum Resistance at 75 degree celsius=',round(rmax75/1000,4),'kilo ohm'\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "collapsed": true
+ },
+ "source": [
+ "##Example 2-2, Page Number: 20\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Maximum percentage error= 2.8 %\n",
+ "V=( 180 V ± 2.8 %)\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Variable Declaration\n",
+ "\n",
+ "V1=100 #in V \n",
+ "V2=80 #in V\n",
+ "p1=1.0/100 #Percentage error of V1\n",
+ "p2=5.0/100 #Percentage error of V2\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "V1max=V1+V1*p1 #in V\n",
+ "V2max=V2+V2*p2 #in V \n",
+ "\n",
+ "\n",
+ "Emax=V1max+V2max #in V\n",
+ "E=V1+V2 #in V\n",
+ "\n",
+ "p=100*(Emax-E)/E #Percentage\n",
+ "\n",
+ "#Results\n",
+ "print 'Maximum percentage error=',round(p,1),'%'\n",
+ "print 'V=(',E,'V ±',round(p,1),'%)'\n",
+ "\n",
+ "\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example 2-3, Page Number: 22"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Maximum percentage error= ± 25 %\n",
+ "Voltage=( 20 V ± 25 %)\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Variable Declaration\n",
+ "\n",
+ "V1=100 #in V \n",
+ "V2=80 #in V \n",
+ "p1=1.0/100 #Percentage error of V1\n",
+ "p2=5.0/100 #Percentage error of V2\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "E=V1-V2 #in V\n",
+ "V1max=V1+V1*p1 #in V \n",
+ "V2min=V2-V2*p2 #in V\n",
+ "Emax=V1max-V2min #in V\n",
+ "\n",
+ "p=100*(Emax-E)/E #percentage\n",
+ "\n",
+ "#Results\n",
+ "print 'Maximum percentage error= ±',int(p),'%'\n",
+ "print 'Voltage=(',E,'V ±',int(p), '%)'\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example 2-4, Page Number: 23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Power= 82 mW\n",
+ "Percentage error in power= ± 20 %\n",
+ "Power=( 82 mW ± 20 %)\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "#Variable Declaration\n",
+ "r=820 #Resistance(ohm)\n",
+ "r_accuracy=10.0/100 #Accuracy of r in percentage\n",
+ "I=10*10**(-3) #Current(A)\n",
+ "I_accuracy=2.0/100 #Accuracy of I at Full scale in percentage\n",
+ "Imax=25*10**(-3) #Full scale current(A)\n",
+ "\n",
+ "#Calculations\n",
+ "power=r*(I**2) #in Watt\n",
+ "\n",
+ "I_error=I_accuracy*Imax\n",
+ "\n",
+ "I_error_percentage=100*I_error/(10*10**(-3))\n",
+ "\n",
+ "Isquare_error=2*I_error_percentage\n",
+ "\n",
+ "p_error=Isquare_error+(r_accuracy*100) \n",
+ "\n",
+ "\n",
+ "#Results\n",
+ "print 'Power=',int(power*1000),' mW'\n",
+ "print 'Percentage error in power= ±',int(p_error), '%'\n",
+ "print 'Power=(',int(power*1000),'mW ±',int(p_error),'%)'\n",
+ "\n",
+ "\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example 2-5, Page Number: 25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Average Deviation= 0.0012 volt\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Variable Declaration\n",
+ "V=[1.001,1.002,0.999,0.998,1.000] #Voltage readings\n",
+ "v_average=0.0 #Variable to hold average value\n",
+ "d=[0]*5 #Array of 5 elements to hold deviation\n",
+ "D_average=0.0 #Variable to hold average deviation\n",
+ "\n",
+ "#Calculation\n",
+ "#To find average\n",
+ "for i in range(0,5):\n",
+ " v_average=v_average+V[i]\n",
+ " \n",
+ "v_average=v_average/5.0\n",
+ "\n",
+ "#To find deviations\n",
+ "for i in range(0,5):\n",
+ " d[i]=V[i]-v_average\n",
+ "\n",
+ "#To find mean deviation \n",
+ "for i in range(0,5):\n",
+ " D_average=D_average+math.fabs(d[i])\n",
+ "\n",
+ "D_average=D_average/5\n",
+ "\n",
+ "print 'Average Deviation=',round(D_average,5),'volt'"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example 2-6, Page Number: 26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Standard Deviation= 0.0014 V\n",
+ "Probable Error= 0.94 mV\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "#Variable Declaration\n",
+ "\n",
+ "V=[1.001,1.002,0.999,0.998,1.000] #Voltage readings in V expressed as an array\n",
+ "v_average=0.0 #Variable to hold average value\n",
+ "d=[0]*5 #Array of 5 elements to hold deviation\n",
+ "D_average=0.0 #Variable to hold average deviation\n",
+ "std_deviation=0.0\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "#To find average\n",
+ "for i in range(0,5):\n",
+ " v_average=v_average+V[i]\n",
+ " \n",
+ "v_average=v_average/5.0\n",
+ "\n",
+ "#To find deviations\n",
+ "for i in range(0,5):\n",
+ " d[i]=V[i]-v_average\n",
+ "\n",
+ "#To find standard deviation \n",
+ "for i in range(0,5):\n",
+ " std_deviation=std_deviation+d[i]**2\n",
+ "\n",
+ "std_deviation=math.sqrt(std_deviation/5)\n",
+ "\n",
+ "probable_error=0.6745*round(std_deviation,4)\n",
+ "print 'Standard Deviation=',round(std_deviation,4),'V'\n",
+ "print 'Probable Error=',round(probable_error*1000,2),'mV'"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "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.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}