# CHAPTER 2: MEASUREMENT ERRORS¶

## Example 2-1, Page Number: 16¶

In [4]:
import math
#Variable Declaration

#Resistance Values at 25 degree Celsius
rmax25=1.26*10**3                  #in ohm
rmin25=1.14*10**3                  #in ohm
r=1.2*10**3                        #in ohm
ppm=500.0/1000000

#Calculations

absolute_error=rmax25-r           #in ohm

#Tolerance value in percentage
tolerance=absolute_error/r*100    #percentage

#Resistance per degree Celsius
rperc=rmax25*ppm

#To Calculate ressistance at 75 degree celsius

dT=75-25                          #degree celsius

dR=rperc*dT                       #in ohm

#Maximum resistance at 75 degree celsius

rmax75=rmax25+dR                  #in ohm

#Results
print 'Tolerance of the resistance= ±',int(tolerance),'%'
print 'Maximum Resistance at 75 degree celsius=',round(rmax75/1000,4),'kilo ohm'

Tolerance of the resistance= ± 5 %
Maximum Resistance at 75 degree celsius= 1.2915 kilo ohm


## Example 2-2, Page Number: 20¶

In [5]:
import math
#Variable Declaration

V1=100              #in V
V2=80               #in V
p1=1.0/100          #Percentage error of V1
p2=5.0/100          #Percentage error of V2

#Calculations
V1max=V1+V1*p1      #in V
V2max=V2+V2*p2      #in V

Emax=V1max+V2max    #in V
E=V1+V2             #in V

p=100*(Emax-E)/E    #Percentage

#Results
print 'Maximum percentage error=',round(p,1),'%'
print 'V=(',E,'V ±',round(p,1),'%)'

Maximum percentage error= 2.8 %
V=( 180 V ± 2.8 %)


## Example 2-3, Page Number: 22¶

In [7]:
import math
#Variable Declaration

V1=100              #in V
V2=80               #in V
p1=1.0/100          #Percentage error of V1
p2=5.0/100          #Percentage error of V2

#Calculations
E=V1-V2            #in V
V1max=V1+V1*p1     #in V
V2min=V2-V2*p2     #in V
Emax=V1max-V2min   #in V

p=100*(Emax-E)/E   #percentage

#Results
print 'Maximum percentage error= ±',int(p),'%'
print 'Voltage=(',E,'V ±',int(p), '%)'

Maximum percentage error= ± 25 %
Voltage=( 20 V ± 25 %)


## Example 2-4, Page Number: 23¶

In [6]:
import math
#Variable Declaration
r=820                       #Resistance(ohm)
r_accuracy=10.0/100         #Accuracy of r in percentage
I=10*10**(-3)               #Current(A)
I_accuracy=2.0/100          #Accuracy of I at Full scale in percentage
Imax=25*10**(-3)            #Full scale current(A)

#Calculations
power=r*(I**2)              #in Watt

I_error=I_accuracy*Imax

I_error_percentage=100*I_error/(10*10**(-3))

Isquare_error=2*I_error_percentage

p_error=Isquare_error+(r_accuracy*100)

#Results
print 'Power=',int(power*1000),' mW'
print 'Percentage error in power= ±',int(p_error), '%'
print 'Power=(',int(power*1000),'mW ±',int(p_error),'%)'

Power= 82  mW
Percentage error in power= ± 20 %
Power=( 82 mW ± 20 %)


## Example 2-5, Page Number: 25¶

In [7]:
import math

#Variable Declaration
v_average=0.0                         #Variable to hold average value
d=[0]*5                               #Array of 5 elements to hold deviation
D_average=0.0                         #Variable to hold average deviation

#Calculation
#To find average
for i in range(0,5):
v_average=v_average+V[i]

v_average=v_average/5.0

#To find deviations
for i in range(0,5):
d[i]=V[i]-v_average

#To find mean deviation
for i in range(0,5):
D_average=D_average+math.fabs(d[i])

D_average=D_average/5

print 'Average Deviation=',round(D_average,5),'volt'

Average Deviation= 0.0012 volt


## Example 2-6, Page Number: 26¶

In [2]:
import math

#Variable Declaration

V=[1.001,1.002,0.999,0.998,1.000]     #Voltage readings in V expressed as an array
v_average=0.0                         #Variable to hold average value
d=[0]*5                               #Array of 5 elements to hold deviation
D_average=0.0                         #Variable to hold average deviation
std_deviation=0.0

#Calculation

#To find average
for i in range(0,5):
v_average=v_average+V[i]

v_average=v_average/5.0

#To find deviations
for i in range(0,5):
d[i]=V[i]-v_average

#To find standard deviation
for i in range(0,5):
std_deviation=std_deviation+d[i]**2

std_deviation=math.sqrt(std_deviation/5)

probable_error=0.6745*round(std_deviation,4)
print 'Standard Deviation=',round(std_deviation,4),'V'
print 'Probable Error=',round(probable_error*1000,2),'mV'

Standard Deviation= 0.0014 V
Probable Error= 0.94 mV