# To find Average voltage Range of error
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-1 in Page 3
# Given data
E_1 = 117.02 # Voltage observed by 1st observer is 117.02V
E_2 = 117.11 # Voltage observed by 2nd observer is 117.11V
E_3 = 117.08 # Voltage observed by 3rd observer is 117.08V
E_4 = 117.03 # Voltage observed by 4th observer is 117.03V
#Calculations
E_av = (E_1+E_2+E_3+E_4)/4
print "(a) The average voltage, E_av =",E_av,"V"
E_max = max (E_1,E_2,E_3,E_4) # Maximum value among the 4 nos
E_min = min (E_1,E_2,E_3,E_4) # Minimum value among the 4 nos
range_1 = E_max - E_av # Range calculated using two different formulae
range_2 = E_av - E_min # Range calculated using two different formulae
avg_range = (range_1+range_2)/2
print "(b) The average range of error = +/-",round(avg_range,2),"V"
#Result
# (a) The average voltage, E_av = 117.06 V
# (b) The average range of error = +/- 0.05 V
# To find Total resistance
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-2 in Page 4
# Given data
R_1 = 18.7 # The first resistance is 18.7ohm
R_2 = 3.624 # The second resistance is 3.624ohm
# Calculations
R_T = R_1 + R_2 # formula to calculate total resistance in series
print "The total resistance connected in series =",R_T," ohm\n"
print "As one of the resistance is accurate to only tenths of an ohm, The result should be reduced to the nearest tenth. \n Hence "
print "the total resistance is =",round(R_T,1)," ohm"
#Result
# The total resistance connected in series = 22.324 ohm
# As one of the resistance is accurate to only tenths of an ohm, The result should be reduced to the nearest tenth.
# Hence the total resistance is = 22.3 ohm
# To find voltage drop across resistor
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-3 in Page 4
# Given data
I = 3.18 #Current flowing through the resistor = 3.18A
R = 35.68 # The value of resistor = 35.68ohm
# Calculations
E = I*R
print "The voltage drop across the resistor = ",E,"volts"
print "Since there are 3 significant figures involved in the multiplication, the result can be written only to a max of 3 significant figures"
print "Hence the voltage drop across the resistor = ",round(E)," volts"
#Result
# The voltage drop across the resistor = 113.4624 volts
# Since there are 3 significant figures involved in the multiplication, the result can be written only to a max of 3 significant figures
# Hence the voltage drop across the resistor = 113 volts
# To find sum with range of doubt
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-4 in Page 5
# Given data
# let N_1 = X_1 +/- Y_1
# N_2 = X_2 +/- Y_2
X_1 = 826.0
Y_1 = 5
X_2 = 628.0
Y_2 = 3
#Calculations
X = (X_1 + X_2)
Y = (Y_1 + Y_2)
print "SUM = ",X," +/- ",Y
doubt = Y/X*100
print "The percentage range of doubt = +/-",round(doubt,3)
#Result
# SUM = 1454 +/- 8
# The percentage range of doubt = +/-0.55%
# To find difference with range of doubt
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-5 in Page 5
# Given data
# let N_1 = X_1 +/- Y_1
# N_2 = X_2 +/- Y_2
X_1 = 826.0
Y_1 = 5
X_2 = 628
Y_2 = 3
X = (X_1 - X_2)
Y = (Y_1 + Y_2)
print "SUM = ",X," +/- ",Y
doubt = Y/X*100
print "The percentage range of doubt = +/-",round(doubt,3)
#Result
# Difference = 198 +/- 8
# The percentage range of doubt = +/-4.04%
# To find difference with range of doubt
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-6 in Page 5
# Given data
# let N_1 = X_1 +/- Y_1
# N_2 = X_2 +/- Y_2
X_1 = 462.0
Y_1 = 4
X_2 = 437.0
Y_2 = 4
#Calculations
X = (X_1 - X_2)
Y = (Y_1 + Y_2)
print "SUM = ",X," +/- ",Y
doubt = Y/X*100
print "The percentage range of doubt = +/-",round(doubt,3)
#Result
# Difference = 25 +/- 8
# The percentage range of doubt = +/-32.00%
# To find Apparent and actual resistance
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-7 in Page 6
# Given data
I_T = 5*(10**-3) # Reading of the milliammeter in ampere
V_T = 100 # Reading of the voltmeter in volt
sensitivity = 1000 # sensitivity of voltmeter in ohm/volt
scale = 150 # scale of the voltmeter
#Calculations
R_T = V_T / I_T # formula to calculate total circuit resistance
print "(a) The apparent circuit resistance neglecting the resistance of milliammeter, R_T = ",R_T," ohm\n"
R_V = sensitivity * scale # calculating resistance of voltmeter
R_X = (R_T * R_V)/(R_V - R_T) # effective circuit resistance due to loading effect
print "(b) The actual circuit resistance with the loading effect of voltmeter, R_X = ",round(R_X,2)," ohm\n"
percentage_error = (R_X - R_T)*100/ R_X
# %error = (actual-apparent)/ actual
print "(c) The percentage error due to loading effect of voltmeter = ",round(percentage_error,2),"%"
#result
# (a) The apparent circuit resistance neglecting the resistance of milliammeter, R_T = 20000 ohm
# (b) The actual circuit resistance with the loading effect of voltmeter, R_X = 23076.92 ohm
# (c) The percentage error due to loading effect of voltmeter = 13.33%
# The result shown in the textbook is printed incorrectly and does not match with the correct result
# To find Apparent and actual resistance
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-8 in Page 7
# Given data
I_T = 800*(10**-3) # Reading of the milliammeter in ampere
V_T = 40 # Reading of the voltmeter in volt
sensitivity = 1000 # sensitivity of voltmeter in ohm/volt
scale = 150 # scale of the voltmeter
#Calculations
R_T = V_T / I_T # formula to calculate total circuit resistance
print "(a) The apparent circuit resistance neglecting the resistance of milliammeter, R_T = ",R_T," ohm\n"
R_V = sensitivity * scale # calculating resistance of voltmeter
R_X = (R_T * R_V)/(R_V - R_T) # effective circuit resistance due to loading effect
print "(b) The actual circuit resistance with the loading effect of voltmeter, R_X = ",round(R_X,2)," ohm\n"
percentage_error = (R_X - R_T)*100/ R_X
# %error = (actual-apparent)/ actual
print "(c) The percentage error due to loading effect of voltmeter = ",round(percentage_error,2),"%"
#result
# (a) The apparent circuit resistance neglecting the resistance of milliammeter, R_T = 50.00 ohm
# (b) The actual circuit resistance with the loading effect of voltmeter, R_X = 50.02 ohm
# (c) The percentage error due to loading effect of voltmeter = 0.03%
# The result shown in the textbook is printed incorrectly and does not match with the correct result
# To find Arithmatic mean and deviation from mean
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-9 in Page 9
# Given data
# Independent current measurements taken by six observers
I_1 = 12.8*(10**-3)
I_2 = 12.2*(10**-3)
I_3 = 12.5*(10**-3)
I_4 = 13.1*(10**-3)
I_5 = 12.9*(10**-3)
I_6 = 12.4*(10**-3)
#Calculations
arithmatic_mean = (I_1 +I_2 +I_3 +I_4 +I_5 +I_6)/6
print "(a) The arithmatic mean of the observations =",arithmatic_mean,"A"
d_1 = I_1 - arithmatic_mean
d_2 = I_2 - arithmatic_mean
d_3 = I_3 - arithmatic_mean
d_4 = I_4 - arithmatic_mean
d_5 = I_5 - arithmatic_mean
d_6 = I_6 - arithmatic_mean
#deviation calculated using the formula d_n = x_n - arithmatic_mean
disp('(b) The deviations from the mean are:' )
print "d_1 = ",d_1," A\n d_2 = ",d_2," A\n d_3 = ",d_3," A\n d_4 = ", d_4," A\n d_5 = ",d_5," A\n d_6 =",d_6," A"
#Result
# (a) The arithmatic mean of the observations =0.01265 A
# (b) The deviations from the mean are:
# d_1 = 0.00015 A
# d_2 = -0.00045 A
# d_3 = -0.00015 A
# d_4 = 0.00045 A
# d_5 = 0.00025 A
# d_6 = -0.00025 A
# To find Average deviation
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-10 in Page 10
# Given data
# These are the data found out from the example_1-9
d_1 = 0.000150
d_2 = -0.000450
d_3 = -0.000150
d_4 = 0.000450
d_5 = 0.000250
d_6 = -0.000250
#Calculation
D = (abs(d_1) +abs(d_2) +abs(d_3) +abs(d_4) +abs(d_5) +abs(d_6))/6
print "The average deviation, D = ",round(D,6),"A"
#Result
# The average deviation, D = 2.83e-004 A
# To find Std deviation and Probable error
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-11 in Page 14
import numpy
# Given data
# let the 10 resistance measurements in ohm be taken as elements of matrix
x = [101.2,101.7,101.3,101.0,101.5,101.3,101.2,101.4,101.3,101.1]
#Calculations
arithmatic_mean = numpy.mean(x)
sigma = numpy.std(x)
probable_error = 0.6745 * sigma
print "(a) The arithmatic mean of the readings = ",arithmatic_mean," ohm\n"
print "(b) The standard deviation of the readings = ",round(sigma,1)," ohm\n"
print "(c) The probable error of the readings = ",round(probable_error,2),"ohm"
#Result
# (a) The arithmatic mean of the readings = 101.3 ohm
# (b) The standard deviation of the readings = 0.2 ohm
# (c) The probable error of the readings = 0.13 ohm
# To find Limiting error
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-12 in Page 14
# Given data
scale = 150
percentage_accuracy = 1.0/100# accuracy of 1% full scale reading
V = 83 #voltage measured by instrument = 83 volt
#Calculations
limiting_error = percentage_accuracy * scale
print "The magnitude of the limiting error = ",limiting_error," V\n"
percentage_error = limiting_error/V * 100
print "The percentage limiting error = ",round(percentage_error,2)," percent"
#Result
# The magnitude of the limiting error = 1.5 V
# The percentage limiting error = 1.81 percent
# To find the maximum error
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-13 in Page 15
# Given data
# For the given tolerence of 0.1%
# highest value of resistor is 1.001 times the nominal value
# lowest value of resistor is 0.999 times the nominal value
#Calculations
V_out_max = 1.001 * 1.001/ 0.999
V_out_min = 0.999 * 0.999/ 1.003
total_var = 0.1 * 3 # total variation of the resultant voltage is sum of tolerences
print "The total variation of the resultant voltage = +/- ",total_var,"%"
#Result
# The total variation of the resultant voltage = +/- 0.3 %
# To find limiting error
# Modern Electronic Instrumentation And Measurement Techniques
# By Albert D. Helfrick, William D. Cooper
# First Edition Second Impression, 2009
# Dorling Kindersly Pvt. Ltd. India
# Example 1-14 in Page 16
# Given data
# let I = X_1 +/- Y_1
# R = X_2 +/- Y_2
X_1 = 2.00
Y_1 = 0.5
X_2 = 100
Y_2 = 0.2
#Calculations
P_1 = ((1+0.005)**2)*(1+0.002)
print "For the worst possible combination of the values of current and resistance,\nThe highest power dissipation becomes,\n"
print "P = ",round(P_1,3)," (I**2)*R Watts"
P_2 = ((1-0.005)**2)*(1-0.002)
print "For the lowest power dissipation.\nP = ",round(P_2,3)," (I**2)*R Watts\n"
lim_error = 2 * Y_1 + Y_2
print "The limiting error = +/- ",lim_error,"%"
#Result
# For the worst possible combination of the values of current and resistance,
# The highest power dissipation becomes,
# P = 1.012 (I**2)*R Watts
# For the lowest power dissipation.
# P = 0.988 (I**2)*R Watts
# The limiting error = +/- 1.2%