You are on page 1of 122

Scilab Textbook Companion for

A Course In Mechanical Measurements And


Instrumentation
by A. K. Sawhney And P. Sawhney1
Created by
Parul
Instrumentation
Electrical Engineering
Thapar University
College Teacher
Dr. Sunil K Singla
Cross-Checked by

August 4, 2014

1 Funded

by a grant from the National Mission on Education through ICT,


http://spoken-tutorial.org/NMEICT-Intro. This Textbook Companion and Scilab
codes written in it can be downloaded from the Textbook Companion Project
section at the website http://scilab.in

Book Description
Title: A Course In Mechanical Measurements And Instrumentation
Author: A. K. Sawhney And P. Sawhney
Publisher: Dhanpat Rai, New Delhi
Edition: 12
Year: 2001
ISBN: 8177000233

Scilab numbering policy used in this document and the relation to the
above book.
Exa Example (Solved example)
Eqn Equation (Particular equation of the above book)
AP Appendix to Example(Scilab Code that is an Appednix to a particular
Example of the above book)
For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 means
a scilab code whose theory is explained in Section 2.3 of the book.

Contents
List of Scilab Codes

2 Static Characteristics of Instruments and Measurement systems


12
3 Errors in Measurements and Their Statistical Analysis

25

4 Dynamic Characteristics of Instruments and Measurement


systems
48
5 Primary Sensing Elements and Transducers

59

6 Signal Conditioning

84

7 Display Devices and recorders

100

8 Metrology

106

9 Pressure Measurements

111

List of Scilab Codes


Exa 2.1
Exa 2.2
Exa 2.3
Exa 2.4
Exa 2.5

Exa
Exa
Exa
Exa

2.6
2.7
2.8
2.9

Exa 2.10
Exa 2.12
Exa 2.13
Exa 2.14
Exa 2.15
Exa 2.16
Exa 2.17
Exa 2.18

calculating static error and static correction . . . . . .


calculating true value of the temperature . . . . . . .
calculating Relative error expressed as a percentage of f
sd. . . . . . . . . . . . . . . . . . . . . . . . . . . . .
calculating static error and static correction . . . . . .
calculating maximum static error Span of the thermometer degree C Accuracy of the thermometer in terms of
percentage of span . . . . . . . . . . . . . . . . . . . .
calculating the pressure for a dial reading of 100 . . .
calculating the noise output voltage of the amplifier .
calculating the noise voltage . . . . . . . . . . . . . . .
calculating the signal to noise ratio at input calculating
the signal to noise ratio at output calculating the noise
factor and noise figure . . . . . . . . . . . . . . . . . .
calculating the ratio of output signal to noise signal . .
calculating the average force and range of error . . . .
calculating the sum of resistances connected in series
with uncertainity of one unit . . . . . . . . . . . . . .
calculating the power with uncertainity of one unit in
voltage and current . . . . . . . . . . . . . . . . . . .
calculating the sum of resistances connected in series
with appropriate number of significant figure . . . . .
calculating the voltage drop with appropriate number
of significant figure . . . . . . . . . . . . . . . . . . . .
calculating the sensitivity and deflection factor of wheatstone bridge . . . . . . . . . . . . . . . . . . . . . . .
calculating the volume of the mercury thermometer . .

12
12
13
13

14
14
15
15

16
16
17
17
18
18
19
19
20

Exa 2.19
Exa
Exa
Exa
Exa

2.20
2.22
2.23
2.24

Exa 2.25
Exa 2.26
Exa 2.27
Exa 2.28
Exa
Exa
Exa
Exa
Exa
Exa

2.29
3.1
3.2
3.3
3.4
3.5

Exa 3.6
Exa 3.7
Exa 3.8
Exa 3.9
Exa
Exa
Exa
Exa

3.10
3.11
3.12
3.13

Exa 3.14
Exa 3.15
Exa 3.16
Exa 3.17
Exa 3.18

calculating the maximum position deviation resistance


deviation . . . . . . . . . . . . . . . . . . . . . . . . .
calculating the dead zone . . . . . . . . . . . . . . . .
calculating the Resolution . . . . . . . . . . . . . . . .
calculating the Resolution . . . . . . . . . . . . . . . .
calculating the reading of the multimeter and percentage error . . . . . . . . . . . . . . . . . . . . . . . . .
calculating the reading of the multimeter and percentage error . . . . . . . . . . . . . . . . . . . . . . . . .
calculating the loading error . . . . . . . . . . . . . . .
calculating the voltage across the oscilloscope . . . . .
calculating the actual value of current measured value
of current and percentage error . . . . . . . . . . . . .
calculating the maximum available power . . . . . . .
calculating guarantee value of capacitance . . . . . . .
calculating percentage limiting error . . . . . . . . . .
Calculate the range of readings . . . . . . . . . . . . .
Calculate the limiting error in percent . . . . . . . . .
Calculate the range of readings specified interms of fsd
and true value . . . . . . . . . . . . . . . . . . . . . .
Calculate the magnitude and limiting error in ohm and
in percentage of the resistance . . . . . . . . . . . . .
calculate the value of relative limiting error in resistance
Calculate the guaranteed values of the resistance . . .
Calculate the percentage limiting error and range of resistance values . . . . . . . . . . . . . . . . . . . . . .
Calculate the magnitude of power and limiting error .
Calculate the magnitude of Force and limiting error .
calculate the power loss and relative error . . . . . . .
Calculate the true power as a percentage of measured
power . . . . . . . . . . . . . . . . . . . . . . . . . . .
calculate the total resistance error of each register and
fractional error of total resistance . . . . . . . . . . . .
find the error . . . . . . . . . . . . . . . . . . . . . . .
calculate the Volume and relative error . . . . . . . . .
calculate the per unit change in the value of spring for
different temperature ranges . . . . . . . . . . . . . .
Calculate apparent resistance actual resistance and error
5

20
20
21
21
21
22
22
23
23
24
25
25
26
26
27
27
28
28
29
30
30
31
31
32
33
33
34
34

Exa 3.19
Exa 3.20
Exa 3.21
Exa 3.22
Exa 3.23

Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa

3.24
3.25
3.26
3.27
3.28
3.29
3.30
3.31

Exa 3.32
Exa 3.34
Exa 3.35
Exa 3.37
Exa 3.38
Exa 3.39
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa

3.40
3.41
4.1
4.2
4.4
4.5
4.6
4.8
4.9

Calculate apparent resistance actual resistance and error


Calculate the error and percentage error in the measurement of deflection . . . . . . . . . . . . . . . . . . . .
to find the mean deviations from the mean Average deviation standard deviation and variance . . . . . . . .
to find the mean standard deviation probable error and
range . . . . . . . . . . . . . . . . . . . . . . . . . . .
to find the arithematic mean maen deviation standard
deviation prpobable error of 1 reading standard deviation and probable error of mean standard deviation of
standard deviation . . . . . . . . . . . . . . . . . . . .
to find probable no of resistors . . . . . . . . . . . . .
to find no of 100 rsding exceed 30mm . . . . . . . . .
to find no of rods of desired length . . . . . . . . . . .
to find standard deviation and probability of error . .
to find no of expected readings . . . . . . . . . . . . .
to calculate precision index of instrument . . . . . . .
to find confidence interval for given confidence levels .
to point out the reading that can be rejected by chavenets
criterion . . . . . . . . . . . . . . . . . . . . . . . . . .
calculate standard deviation . . . . . . . . . . . . . . .
determine value of total current considering errors as
limiting errors ans as standrd deviations . . . . . . . .
determine probable error in the computed value of resistnce . . . . . . . . . . . . . . . . . . . . . . . . . . .
to find Cq and its possible errors . . . . . . . . . . . .
calculate power disipated and uncertaainity in power .
to find uncertainity in combined resistance in both series
and in parrallel . . . . . . . . . . . . . . . . . . . . . .
to calculate uncertainity in measurement . . . . . . . .
to calculate uncertainity in power . . . . . . . . . . . .
calculating the temperature . . . . . . . . . . . . . . .
calculate time to read half of the temperature difference
Calculate the temperature after 10s . . . . . . . . . .
Calculate the value of resistance after 15s . . . . . . .
Calculate the depth after one hour . . . . . . . . . . .
Calculate time constant . . . . . . . . . . . . . . . . .
Calculate the temperature after 10s . . . . . . . . . .
6

35
35
36
37

37
38
38
39
39
40
40
41
42
42
43
44
44
45
45
46
47
48
48
49
49
49
50
50

Exa 4.10
Exa 4.11
Exa 4.12
Exa 4.13

Exa
Exa
Exa
Exa

4.14
4.15
4.16
4.17

Exa 4.18
Exa 4.19
Exa 4.20
Exa
Exa
Exa
Exa
Exa
Exa
Exa

4.21
4.22
4.23
5.1
5.2
5.3
5.4

Exa 5.5
Exa 5.6
Exa 5.7
Exa
Exa
Exa
Exa
Exa
Exa

5.8
5.9
5.10
5.11
5.12
5.13

Exa 5.14

Calculate the temperature at a depth of 1000 m . . . .


Calculate the value of resistance at different values of
time . . . . . . . . . . . . . . . . . . . . . . . . . . . .
calculate the value of damping constant and frequency
of damped oscillations . . . . . . . . . . . . . . . . . .
Calculate damping ratio natural frequency frequency of
damped oscillations time constant and steady state error
for ramp signal . . . . . . . . . . . . . . . . . . . . . .
Calculate the natural frequency . . . . . . . . . . . . .
Calculate natural frequency and setteling time . . . .
Calculate time lag and ratio of output and input . . .
Calculate the maximum allowable time constant and
phase shift . . . . . . . . . . . . . . . . . . . . . . . .
Calculate maximum value of indicated temperature and
delay time . . . . . . . . . . . . . . . . . . . . . . . .
Find the output . . . . . . . . . . . . . . . . . . . . .
Calculate maximum and minimum value of indicated
temperature phase shift time lag . . . . . . . . . . . .
determine damping ratio . . . . . . . . . . . . . . . . .
Calculate the frequency range . . . . . . . . . . . . . .
determine the error . . . . . . . . . . . . . . . . . . .
Calculate the deflection at center . . . . . . . . . . . .
Calculate the angle of twist . . . . . . . . . . . . . . .
Calculate the Torque . . . . . . . . . . . . . . . . . . .
Calculating the displacement and resolution of the potentiometer . . . . . . . . . . . . . . . . . . . . . . . .
plot the graph of error versus K . . . . . . . . . . . . .
Calculating the output voltage . . . . . . . . . . . . .
Calculating the maximum excitation voltage and the
sensitivity . . . . . . . . . . . . . . . . . . . . . . . . .
Calculating the resolution of the potentiometer . . . .
Checking the suitability of the potentiometer . . . . .
Checking the suitability of the potentiometer . . . . .
Calculating the possion ratio . . . . . . . . . . . . . .
Calculating the value of the resistance of the gauges .
calculate the percentage change in value of the gauge
resistance . . . . . . . . . . . . . . . . . . . . . . . . .
Calculating the Gauge factor . . . . . . . . . . . . . .
7

51
51
52

53
53
54
54
55
55
56
56
57
58
58
59
59
60
60
61
61
61
62
62
63
63
63
64
64

Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa

5.15
5.16
5.17
5.18
5.19
5.20
5.21
5.22
5.23
5.24
5.25
5.26
5.27
5.28
5.29
5.30
5.31
5.32
5.33

Exa 5.34
Exa 5.35
Exa 5.36
Exa
Exa
Exa
Exa
Exa

5.37
5.40
5.41
5.42
5.43

Exa 5.44
Exa 5.45

Exa 5.46

Calculating the change in length and the force applied


Calculate the linear approximation . . . . . . . . . . .
Calculate the linear approximation . . . . . . . . . . .
Calculate the resistance and the temperature . . . . .
Calculate the resistance . . . . . . . . . . . . . . . . .
Calculate the time . . . . . . . . . . . . . . . . . . . .
Calculate the resistance . . . . . . . . . . . . . . . . .
find resistance . . . . . . . . . . . . . . . . . . . . . .
calculating the change in temperature . . . . . . . . .
calculating the frequencies of oscillation . . . . . . . .
Calculating the sensitivity and maximum output voltage
Calculating the temperature . . . . . . . . . . . . . . .
Calcating the series resistance and approximate error .
Calculate the values of resistance R1 and R2 . . . . .
Calculate the percentage linearity . . . . . . . . . . . .
Calculate senstivity of the LVDT . . . . . . . . . . . .
calculate the deflection maximum and minimum force
calculating the sensitivity of the transducer . . . . . .
Calculate the value of the capacitance afte the application of pressure . . . . . . . . . . . . . . . . . . . . . .
Calculate the change in frequency of the oscillator . .
Calculate the dielectric stress change in value of capacitance . . . . . . . . . . . . . . . . . . . . . . . . . . .
Calculate the value of time constant phase shift series
resistance amplitude ratio and voltage sensitivity . . .
Calculate the change in capacitance and ratio . . . . .
Calculate the output voltage and charge sensitivity . .
Calculate the force . . . . . . . . . . . . . . . . . . . .
Calculate the strain charge and capacitance clc . . . .
calculate peak to peak voltage swing under open and
loaded conditions calculate maximum change in crystal
thickness . . . . . . . . . . . . . . . . . . . . . . . . .
Calculate the minimum frequency and phase shift . . .
calculate sensitivity of the transducer high frequency
sensitivity Lowest frequency Calculate external shunt
capacitance and high frequency sensitivity after connecting the external shunt capacitance . . . . . . . . .
calculate op volatge . . . . . . . . . . . . . . . . . . .
8

65
65
66
66
67
67
67
68
68
69
69
70
70
70
71
71
72
72
73
73
74
74
75
76
76
76

77
78

78
79

Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa

5.47
5.48
5.49
5.50
5.51
5.52
5.53
5.54
6.1
6.2
6.3
6.4
6.5
6.6
6.7
6.8
6.9
6.10
6.11

Exa 6.12
Exa 6.13
Exa 6.14
Exa 6.15
Exa 6.16
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa

6.17
6.19
6.20
6.21
6.22
6.23
6.24
6.25

to prove time constant should be approximately 20T .


calculate op volatge . . . . . . . . . . . . . . . . . . .
Calculate the threshold wavelength . . . . . . . . . . .
Calculate maximum velocity of emitted photo electrons
Calculate the resistance of the cell . . . . . . . . . . .
Calculate incident power and cut off frequency . . . .
Calculate the internal resistance of cell and open circuit
voltage . . . . . . . . . . . . . . . . . . . . . . . . . .
Find the value of current . . . . . . . . . . . . . . . .
calculating feedback resistance . . . . . . . . . . . . .
calculating the closed loop gain . . . . . . . . . . . . .
calculating the maximum output voltage . . . . . . . .
calculating output voltage due to offset voltage . . . .
calculating Amplification factor . . . . . . . . . . . . .
calculating output voltage due to offset voltage . . . .
calculating gain and feedback resistance . . . . . . . .
Calculating the values of resistances . . . . . . . . . .
Calculating the value of resistance and capacitance . .
Calculating Difference mode gain and output voltage .
Calculating Difference mode Common mode gain and
CMRR . . . . . . . . . . . . . . . . . . . . . . . . . .
Calculating Signal to noise ratio and CMRR . . . . . .
Calculating sensitivity and output voltage . . . . . . .
calculating minimum maximum time constants and value
of frequencies . . . . . . . . . . . . . . . . . . . . . . .
calculating time constant and value of capacitance . .
calcuating the passband gain and upper and lower cut
off frequencies . . . . . . . . . . . . . . . . . . . . . .
calcuating the value of C . . . . . . . . . . . . . . . .
calculate the output voltage and sensitivity . . . . . .
calculate the output voltage for different values of K .
calculating the resistance and output voltage . . . . .
Calculating the bridge output . . . . . . . . . . . . . .
Calculating the resistance of unknown resistance . . .
calculating the current . . . . . . . . . . . . . . . . . .
Calculating maximum permissible current through strain
gauge supply voltage and Power dissipation in series resistance . . . . . . . . . . . . . . . . . . . . . . . . . .
9

80
80
81
81
81
82
82
83
84
84
85
85
85
85
86
86
87
87
88
88
89
89
90
90
91
91
92
92
93
93
94

94

Exa 6.26
Exa 6.27
Exa 6.28
Exa 6.29
Exa 6.30

Exa 6.31
Exa 6.32
Exa 6.33
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa

6.34
7.1
7.2
7.3
7.4
7.5
7.6
7.7
7.8
7.9
7.10
8.1
8.2
8.3
8.4

Exa 8.5
Exa
Exa
Exa
Exa
Exa
Exa
Exa

8.6
8.7
9.1
9.2
9.3
9.4
9.6

Calculating the maximum voltage sensitivity of the bridge


Calculating the resolution of the instrument quantization error and decesion levels . . . . . . . . . . . . . .
Calculating the weight of MSB and LSB . . . . . . . .
Calculating reference voltage and percentage change .
Calculating the number of bits Value of LSB Quantization error minimum sampling rate Aperature time and
dynamic range . . . . . . . . . . . . . . . . . . . . . .
Calculating the value of resistance and smallest output
current . . . . . . . . . . . . . . . . . . . . . . . . . .
Calculating the output voltage . . . . . . . . . . . . .
Calculate the output of successive approximation A to
D . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
to calculate op dc voltage . . . . . . . . . . . . . . . .
calculating resolution . . . . . . . . . . . . . . . . . .
calculating resolution . . . . . . . . . . . . . . . . . .
calculating Total possible error and percentage error .
calculating frequency . . . . . . . . . . . . . . . . . . .
calculating maximum error . . . . . . . . . . . . . . .
calculating number of turns and current . . . . . . . .
calculating speed of the tape . . . . . . . . . . . . . .
calculating number density of the tape . . . . . . . . .
Calculating possible phase angles . . . . . . . . . . . .
Calculating possible phase angles . . . . . . . . . . . .
calculate the arrangement of slip gauges . . . . . . . .
calculate the sensitivity . . . . . . . . . . . . . . . . .
calculate uncertainity in displacement . . . . . . . . .
calculate difference between height of workpieces and
pile of slip gauges . . . . . . . . . . . . . . . . . . . .
calculate seperation distance between two surfaces and
angle of tilt . . . . . . . . . . . . . . . . . . . . . . . .
Calculate the difference in two diameters . . . . . . . .
Calculate the change in thickness along its length . . .
calculating the length of mean free path . . . . . . . .
Calculate Pressure of air source . . . . . . . . . . . . .
Calculate Pressure head . . . . . . . . . . . . . . . . .
calculate height . . . . . . . . . . . . . . . . . . . . . .
calculate error interms of pressure . . . . . . . . . . .
10

95
95
96
96

96
97
98
98
99
100
100
101
102
102
102
103
103
104
104
106
107
108
108
109
109
109
111
112
112
113
113

Exa 9.7
Exa 9.8
Exa 9.9
Exa
Exa
Exa
Exa

9.10
9.11
9.12
9.13

Exa 9.14
Exa 9.15
Exa
Exa
Exa
Exa
Exa

9.16
9.17
9.18
9.19
9.20

calculate angle to which tube is incliend to vertical . .


calculate angle to which tube is incliend to horizontal
calculate Length of scale angle to which tube is incliend
to horizontal . . . . . . . . . . . . . . . . . . . . . . .
calculate diameter of the tube . . . . . . . . . . . . . .
calculate amplification ratio and percentage error . . .
calculate value of counter weight required . . . . . . .
calculate damping factor time constant error and time
lag calculate damping factor natural frequency time constant error and time lag . . . . . . . . . . . . . . . . .
calculate thickness of diaphram and natural frequency
calculate the natural length of the spring and dispacement . . . . . . . . . . . . . . . . . . . . . . . . . . .
calculate the open circuit voltage . . . . . . . . . . . .
calculate the optimum setting . . . . . . . . . . . . . .
calculate the output voltage of bridge . . . . . . . . .
calculate attenuation . . . . . . . . . . . . . . . . . . .
calculate error . . . . . . . . . . . . . . . . . . . . . .

11

113
114
114
115
115
116

116
117
118
118
119
120
120
121

Chapter 2
Static Characteristics of
Instruments and Measurement
systems

Scilab code Exa 2.1 calculating static error and static correction
1 // c a l c u l a t i n g s t a t i c e r r o r and s t a t i c c o r r e c t i o n
2 clc ;
3 disp ( c a l c u l a t i n g s t a t i c e r r o r and s t a t i c c o r r e c t i o n
4
5
6
7
8
9

)
Am = 127.50;
At = 127.43;
e = Am - At ;
disp (e , S t a t i c e r r o r (V)= ) ;
Sc = - e ;
disp ( Sc , S t a t i c C o r r e c t i o n (V)= ) ;

Scilab code Exa 2.2 calculating true value of the temperature


1

// c a l c u l a t i n g t r u e v a l u e o f t h e t e m p e r a t u r e
12

2
3
4
5
6
7

clc ;
disp ( c a l c u l a t i n g t r u e v a l u e o f t h e t e m p e r a t u r e )
Am = 95.45;
Sc = -0.08;
At = Am + Sc ;
disp ( At , True T e m p e r a t u r e ( D e g r e e C)= ) ;

Scilab code Exa 2.3 calculating Relative error expressed as a percentage


of f s d
1
2
3
4
5
6
7
8
9
10
11
12
13

// c a l c u l a t i n g R e l a t i v e e r r o r ( e x p r e s s e d a s a
percentage of f . s . d)
clc ;
disp ( c a l c u l a t i n g R e l a t i v e e r r o r ( e x p r e s s e d a s a
percentage of f . s . d) )
Am = 1.46;
At =1.50;
e = Am - At ;
disp (e , A b s o l u t e e r r o r (V)= ) ;
Sc = - e ;
disp ( Sc , A b s o l u t e C o r r e c t i o n (V)= ) ;
RE =( e / At ) *100;
disp ( RE , R e l a t i v e E r r o r i n t e r m s o f t r u e v a l u e ( i n
p e r c e n t a g e )= ) ;
REF =( e /2.5) *100;
disp ( REF , R e l a t i v e E r r o r i n t e r m s o f t r u e v a l u e ( i n
p e r c e n t a g e )= ) ;

Scilab code Exa 2.4 calculating static error and static correction
1 // c a l c u l a t i n g
2 clc ;

s t a t i c e r r o r and s t a t i c c o r r e c t i o n

13

3
4
5
6
7
8
9

disp ( c a l c u l a t i n g s t a t i c e r r o r and s t a t i c c o r r e c t i o n
)
Am = 0.000161;
At = 0.159*10^ -3;
e = Am - At ;
disp (e , S t a t i c e r r o r (m3/ s )= ) ;
Sc = - e ;
disp ( Sc , S t a t i c C o r r e c t i o n (m3/ s )= ) ;

Scilab code Exa 2.5 calculating maximum static error Span of the thermometer degree C Accuracy of the thermometer in terms of percentage of
span
1 // c a l c u l a t i n g maximum s t a t i c e r r o r
2 disp ( c a l c u l a t i n g maximum s t a t i c e r r o r ) ;
3 // Span o f t h e t h e r m o m e t e r ( d e g r e e C)
4 S =200 -150;
5 // A c c u r a c y o f t h e t h e r m o m e t e r ( i n t e r m s o f p e r c e n t a g e

o f span )
6 A =0.0025;
7 e= A*S;
8 disp (e , Maximum S t a t i c

e r r o r ( d e g r e e C)= ) ;

Scilab code Exa 2.6 calculating the pressure for a dial reading of 100
// c a l c u l a t i n g t h e p r e s s u r e f o r a d i a l r e a d i n g o f
100
2 clc ;
3 disp ( c a l c u l a t i n g t h e p r e s s u r e f o r a d i a l r e a d i n g o f
100 )
4 P =((27.58 -6.895) /150) *100+6.895;
1

14

disp (P , p r e s s u r e f o r a d i a l r e a d i n g o f 1 0 0 ( kN/m2)= )
;

Scilab code Exa 2.7 calculating the noise output voltage of the amplifier
1
2
3
4
5
6
7
8
9
10
11
12

// c a l c u l a t i n g t h e n o i s e o u t p u t v o l t a g e o f t h e
amplifier
clc ;
disp ( c a l c u l a t i n g t h e n o i s e o u t p u t v o l t a g e o f t h e
amplifier )
Bw =100*10^3;
Sn =7*10^ -21;
R =50*10^3;
A =( Sn * R * Bw ) ^0.5;
En =2* A ;
disp ( En , N o i s e v o l t a g e a t i n p u t (V)= ) ;
Ga =100;
Eno = En * Ga ;
disp ( Eno , N o i s e v o l t a g e a t o u t p u t (V)= ) ;

Scilab code Exa 2.8 calculating the noise voltage


1
2
3
4
5
6
7

// c a l c u l a t i n g t h e n o i s e v o l t a g e
clc ;
disp ( c a l c u l a t i n g t h e n o i s e v o l t a g e )
Sn =20;
Vs =3;
Vn = Vs /( Sn ) ^0.5;
disp ( Vn , n o i s e V o l t a g e (mV)= )

15

Scilab code Exa 2.9 calculating the signal to noise ratio at input calculating the signal to noise ratio at output calculating the noise factor and noise
figure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

// c a l c u l a t i n g t h e s i g n a l t o n o i s e r a t i o a t i n p u t
// c a l c u l a t i n g t h e s i g n a l t o n o i s e r a t i o a t o u t p u t
// c a l c u l a t i n g t h e n o i s e f a c t o r and n o i s e f i g u r e
clc ;
disp ( s i g n a l t o n o i s e r a t i o a t i n p u t )
Sni =(3*10^ -6/(1*10^ -6) ) ^2;
disp ( Sni , s i g n a l t o n o i s e r a t i o a t i n p u t= )
disp ( s i g n a l t o n o i s e r a t i o a t o u t p u t )
Sno =(60*10^ -6/(20*10^ -6) ) ^2;
disp ( Sno , s i g n a l t o n o i s e r a t i o a t o u t p u t= )
disp ( New s i g n a l t o n o i s e r a t i o a t o u t p u t )
Snno =(60*10^ -6/(25*10^ -6) ) ^2;
disp ( Snno , s i g n a l t o n o i s e r a t i o a t o u t p u t= )
F = Sni / Snno ;
disp (F , n o i s e F a c t o r= )
nf =10* log10 ( F ) ;
disp ( nf , n o i s e F i g u r e ( dB )= )

Scilab code Exa 2.10 calculating the ratio of output signal to noise signal
1
2
3
4
5
6
7
8
9
10

// c a l c u l a t i n g t h e r a t i o o f o u t p u t s i g n a l t o n o i s e
signal
clc ;
disp ( The n o i s e v o l t a g e i s )
Bw =100*10^3;
K =1.38*10^ -23;
T =300;
R =120;
A =( K * T * R * Bw ) ^0.5;
En =2* A ;
disp ( En , N o i s e v o l t a g e (V)= ) ;
16

11 Eno =0.12*10^ -3;


12 disp ( Eno , N o i s e v o l t a g e a t o u t p u t (V)= ) ;
13 Ra = Eno / En ;
14 disp ( Ra , R a t i o o f s i g n a l v o t a g e t o N o i s e v o l t a g e = )

Scilab code Exa 2.12 calculating the average force and range of error
1
2
3
4
5
6
7
8
9
10
11
12
13
14

// c a l c u l a t i n g t h e a v e r a g e f o r c e and r a n g e o f e r r o r
clc ;
F1 =10.03;
F2 =10.10;
F3 =10.11;
F4 =10.08;
Fav =( F1 + F2 + F3 + F4 ) /4;
disp ( Fav , A v e r a g e F o r c e (N) = ) ;
Fmax = F3 ;
MaxR = Fmax - Fav ;
Fmin = F1 ;
MinR = Fav - Fmin ;
AvgR =( MaxR + MinR ) /2;
disp ( AvgR , A v e r a g e r a n g e o f e r r o r (N)= )

Scilab code Exa 2.13 calculating the sum of resistances connected in series with uncertainity of one unit
1
2
3
4
5
6

// c a l c u l a t i n g t h e sum o f r e s i s t a n c e s c o n n e c t e d i n
s e r i e s w i t h u n c e r t a i n i t y o f one u n i t
clc ;
R1 =72.3;
R2 =2.73;
R3 =0.612;
R =( R1 + R2 + R3 ) ;
17

7
8
9

disp (R , sum o f r e s i s t a n c e s ( ohm ) = ) ;


disp ( t h e r e s u l t a n t r e s i s t a n c e i s 7 5 . 6 ohm w i t h 6 a s
f i r s t doutful figure )

Scilab code Exa 2.14 calculating the power with uncertainity of one unit
in voltage and current
1
2
3
4
5
6
7
8

// c a l c u l a t i n g t h e power w i t h u n c e r t a i n i t y o f one
u n i t i n v o l t a g e and c u r r e n t
clc ;
V =12.16;
I =1.34;
P=V*I;
disp (P , Power (W) = ) ;
disp ( t h e r e s u l t a n t
doutful figure )

i s 16.2 W with 2 as f i r s t

Scilab code Exa 2.15 calculating the sum of resistances connected in series with appropriate number of significant figure
// c a l c u l a t i n g t h e sum o f r e s i s t a n c e s c o n n e c t e d i n
s e r i e s w i t h a p p r o p r i a t e number o f s i g n i f i c a n t
figure
2 clc ;
3 R1 =28.7;
4 R2 =3.624;
1

5
6 R =( R1 + R2 ) ;
7 disp (R , sum o f
8

r e s i s t a n c e s ( ohm ) = ) ;

18

disp ( t h e r e s u l t a n t r e s i s t a n c e i s 3 2 . 3 ohm a s one o f


the r e s i s t a n c e i s accurate to three s i g n i f i c a n t
figure )

Scilab code Exa 2.16 calculating the voltage drop with appropriate number of significant figure
// c a l c u l a t i n g t h e v o l t a g e d r o p w i t h a p p r o p r i a t e
number o f s i g n i f i c a n t f i g u r e
2 clc ;
3 R =31.27;
4 I =4.37;
1

5
6 E=I*R;
7 disp (E , v o l t a g e d r o p (V) = ) ;
8
9 disp ( t h e v o l t a g e d r o p i s 137 V a s one o f t h e

r e s i s t a n c e i s accurate to three s i g n i f i c a n t
figure )

Scilab code Exa 2.17 calculating the sensitivity and deflection factor of
wheatstone bridge
1
2
3
4
5
6
7
8

// c a l c u l a t i n g t h e s e n s i t i v i t y and d e f l e c t i o n f a c t o r
of wheatstone bridge
clc ;
Mo =3;
Mi =7;
Sen = Mo / Mi ;
disp ( Sen , s e n s i t i v i t y (mm p e r ohm ) = ) ;
Df = Mi / Mo ;
disp ( Df , d e f l e c t i o n f a c t o r ( ohm p e r mm) = ) ;
19

Scilab code Exa 2.18 calculating the volume of the mercury thermometer
1
2
3
4
5
6
7

// c a l c u l a t i n g t h e volume o f t h e m e r c u r y t h e r m o m e t e r
clc ;
Ac =( %pi /4) *0.25^2;
disp ( Ac , Area o f m e r c u r y t h e r m o m e t e r )
Lc =13.8*10^3;
Vc = Ac * Lc ;
disp ( Vc , Volume o f m e r c u r y t h e r m o m e t e r (mm3) )

Scilab code Exa 2.19 calculating the maximum position deviation resistance deviation
1
2
3
4
5
6
7
8
9

// c a l c u l a t i n g t h e maximum p o s i t i o n d e v i a t i o n ,
resistance deviation
clc ;
Pl =0.001;
FSD =320;
R =10000;
MDD =( Pl * FSD ) ;
disp ( MDD , Maximum d i s p l a c e m e n t d e v i a t i o n ( d e g r e e )= ) ;
MRD = Pl * R ;
disp ( MRD , Maximum d i s p l a c e m e n t d e v i a t i o n ( ohm )= ) ;

Scilab code Exa 2.20 calculating the dead zone


1 // c a l c u l a t i n g t h e dead z o n e
2 clc ;
3 disp ( s p a n s= )

20

4 s =600;
5 Dz =0.00125* s ;
6 disp ( Dz , Dead z o n e ( d e g r e e C)= ) ;

Scilab code Exa 2.22 calculating the Resolution


1
2
3
4
5
6
7

// c a l c u l a t i n g t h e R e s o l u t i o n
clc ;
Fs =200;
D =100;
SD = Fs / D ;
R = SD /10;
disp (R , r e s o l u t i o n (V)= )

Scilab code Exa 2.23 calculating the Resolution


1
2
3
4
5
6
7

// c a l c u l a t i n g t h e R e s o l u t i o n
clc ;
Fs =9.999;
D =9999;
SD = Fs / D ;
R = SD ;
disp (R , r e s o l u t i o n (V)= )

Scilab code Exa 2.24 calculating the reading of the multimeter and percentage error
// c a l c u l a t i n g t h e r e a d i n g o f t h e m u l t i m e t e r and
percentage error
2 clc ;
1

21

3
4
5
6
7
8
9

Zl =20000;
Zo =10000;
Eo =6;
El = Eo /(1+ Zo / Zl ) ;
disp ( El , R e a d i n g o f t h e m u l t i m e t e r (V)= )
PE =(( El - Eo ) / Eo ) *100;
disp ( PE , P e r c e n t a g e e r r o r= )

Scilab code Exa 2.25 calculating the reading of the multimeter and percentage error
1
2
3
4
5
6
7
8
9

// c a l c u l a t i n g t h e r e a d i n g o f t h e m u l t i m e t e r and
percentage error
clc ;
Zl =20000;
Zo =1000;
Eo =6;
El = Eo /(1+ Zo / Zl ) ;
disp ( El , R e a d i n g o f t h e m u l t i m e t e r (V)= )
PE =(( El - Eo ) / Eo ) *100;
disp ( PE , P e r c e n t a g e e r r o r= )

Scilab code Exa 2.26 calculating the loading error


1
2
3
4
5
6
7
8
9

// c a l c u l a t i n g t h e l o a d i n g e r r o r
clc ;
Zl =1000;
Zo =200*200/400;
Eo =100*200/400;
El = Eo /(1+ Zo / Zl ) ;
disp ( El , R e a d i n g o f t h e m u l t i m e t e r (V)= )
PE =(( El - Eo ) / Eo ) *100;
disp ( PE , P e r c e n t a g e l o a d i n g e r r o r= )
22

10 Ac =100+ PE ;
11 disp ( Ac , A c c u r a c y= )

Scilab code Exa 2.27 calculating the voltage across the oscilloscope
1
2
3
4
5
6
7
8
9
10
11
12
13

// c a l c u l a t i n g t h e v o l t a g e a c r o s s t h e o s c i l l o s c o p e
clc ;
C =50*10^ -6;
f =100000;
disp (f , f r e q u e n c y= )
Xc =1/(2* %pi * f * C ) ;
R =10^6;
Zl =( R * - %i * Xc ) /( R - %i * Xc ) ;
Eo =1;
Zo =10*10^3;
El = Eo /(1+ Zo / Zl ) ;
disp ( El , R e a d i n g o f t h e m u l t i m e t e r (V)= )

Scilab code Exa 2.28 calculating the actual value of current measured
value of current and percentage error
// c a l c u l a t i n g t h e a c t u a l v a l u e o f c u r r e n t , m e a s u r e d
v a l u e o f c u r r e n t and p e r c e n t a g e e r r o r
2 clc ;
1

3
4
5
6
7
8
9
10

Eo =10 -((10*1000) /(1000+1000) ) ;


Zo =((1000*1000) /(1000+1000) ) +500;
Io = Eo / Zo ;
disp ( Io , A c t u a l v a l u e o f c u r r e n t (A)= )
Zl =100;
Il = Eo /( Zo + Zl ) ;
disp ( Il , Measured v a l u e o f c u r r e n t (A)= )
23

11 PE =(( Il - Io ) / Io ) *100;
12 disp ( PE , P e r c e n t a g e l o a d i n g

e r r o r= )

Scilab code Exa 2.29 calculating the maximum available power


1
2
3
4
5
6
7
8
9
10

// c a l c u l a t i n g t h e maximum a v a i l a b l e power
clc ;
Eo =80*10^ -3;
Il =5*10^ -9;
Rl =6*10^6;
Ro =( Eo / Il ) - Rl ;
Pmax =( Eo ^2) /(4* Ro ) ;
disp ( Pmax , Maximum a v a i l a b l e Power (W)= )

24

Chapter 3
Errors in Measurements and
Their Statistical Analysis

Scilab code Exa 3.1 calculating guarantee value of capacitance


1
2
3
4
5
6
7
8

// c a l c u l a t i n g g u a r a n t e e v a l u e o f c a p a c i t a n c e
clc ;
As = 1;
Er =0.05;
Aau = As *(1+ Er ) ;
disp ( Aau , Upper l i m i t ( m i c r o F )= ) ;
Aal = As *(1 - Er ) ;
disp ( Aal , Lower l i m i t ( m i c r o F )= ) ;

Scilab code Exa 3.2 calculating percentage limiting error


1
2
3
4
5

// c a l c u l a t i n g p e r c e n t a g e l i m i t i n g e r r o r
clc ;
As = 150;
Er =0.01;
dA = As * Er ;
25

6 As1 =75;
7 Er =( dA / As1 ) *100;
8 disp ( Er , P e r c e n t a g e

l i m i t i n g e r r o r = );

Scilab code Exa 3.3 Calculate the range of readings


1 // C a l c u l a t e t h e r a n g e o f r e a d i n g s
2 clc ;
3 fsd =1000;
4 TP =100;
5 Efsd =(1/100) *1000;
6 disp ( Efsd , m a g n i t u d e o f E r r o r when s p e c i f i e d

in

t e r m s o f f u l l s c a l e d e f l e c t i o n (w)= )
disp ( Thus t h e m e t e r w i l l r e a d b e t w e e n 90W and 110W
)
8 Etv =(1/100) *100;
9 disp ( Etv , m a g n i t u d e o f E r r o r when s p e c i f i e d i n t e r m s
o f t r u e v a l u e (w)= )
10 disp ( Thus t h e m e t e r w i l l r e a d b e t w e e n 99W and 101W
)
7

Scilab code Exa 3.4 Calculate the limiting error in percent


1
2
3
4
5
6

// C a l c u l a t e t h e l i m i t i n g e r r o r i n p e r c e n t
clc ;
dA =0.05*5*10^ -6;
As =2.5*10^ -6;
Er =( dA / As ) *100;
disp ( Er , p e r c e m t a g e l i m i t i n g e r r o r =+/ )

26

Scilab code Exa 3.5 Calculate the range of readings specified interms of
fsd and true value
1
2
3
4
5
6
7
8
9
10
11
12
13
14

// C a l c u l a t e t h e r a n g e o f r e a d i n g s s p e c i f i e d i n t e r m s
o f f . s . d . and t r u e v a l u e
clc ;
disp ( Range when s p e c i f i e d i n t e r m s o f f . s . d . )
Error_fsd =1*1000/100
Range_lower_value =100 - Error_fsd ;
disp ( Range_lower_value , Lower v a l u e o f r a n g e ( kN/m2)
)
Range_upper_value =100+ Error_fsd ;
disp ( Range_upper_value , Upper v a l u e o f r a n g e ( kN/m2)
)
disp ( Range when s p e c i f i e d i n t e r m s o f True v a l u e )
Error_true =1*100/100
Range_lower_value =100 - Error_true ;
disp ( Range_lower_value , Lower v a l u e o f r a n g e ( kN/m2)
)
Range_upper_value =100+ Error_true ;
disp ( Range_upper_value , Upper v a l u e o f r a n g e ( kN/m2)
)

Scilab code Exa 3.6 Calculate the magnitude and limiting error in ohm
and in percentage of the resistance
1
2
3
4
5
6
7
8

// C a l c u l a t e t h e m a g n i t u d e and l i m i t i n g e r r o r i n ohm
and i n p e r c e n t a g e o f t h e r e s i s t a n c e
clc ;
R1 =37;
R1_le =5* R1 /100;
R2 =75;
R2_le =5* R2 /100;
R3 =50;
R3_le =5* R3 /100;
27

9 R = R1 + R2 + R3 ;
10 disp (R , V a l u e o f r e s i s t a n c e ( ohm )= )
11 R_le = R1_le + R2_le + R3_le ;
12 disp ( R_le , L i m i t i n g V a l u e o f r e s i s t a n c e ( ohm )= )
13 Limiting_error_percentage = R_le *100/ R ;
14 disp ( Limiting_error_percentage , L i m i t i n g V a l u e o f

r e s i s t a n c e ( p e r c e n t a g e )=+/ )

Scilab code Exa 3.7 calculate the value of relative limiting error in resistance
1
2
3
4
5
6

// c a l c u l a t e t h e v a l u e o f
relative limiting error
in r e s i s t a n c e
clc ;
Re_P =1.5;
Re_I =1;
Re_resistance =( Re_P +2* Re_I ) ;
disp ( Re_resistance , t h e v a l u e o f
relative limiting
e r r o r o f r e s i s t a n c e i n p e r c e n t a g e (+/)= )

Scilab code Exa 3.8 Calculate the guaranteed values of the resistance
1 // C a l c u l a t e t h e g u a r a n t e e d v a l u e s o f t h e r e s i s t a n c e
2 clc ;
3 R1 =100;
4 R1_le_perunit =0.5; // R 1 l e p e r u n i t i n d i c a t e s dR1/R1
5
6
7
8
9
10

= 0 . 5%
R2 =1000;
R2_le_perunit =0.5;
R3 =842;
R3_le_perunit =0.5;
Rx = R2 * R3 / R1 ;
disp ( Rx , V a l u e o f r e s i s t a n c e ( ohm )= )
28

11
12
13
14
15
16
17
18
19

Rx_le_perunit = R1_le_perunit + R2_le_perunit +


R3_le_perunit ;
disp ( Rx_le_perunit , L i m i t i n g V a l u e o f r e s i s t a n c e p e r
u n i t ( dRx/Rx )= )
Er_Le = Rx_le_perunit * Rx /100;
disp ( Er_Le , L i m i t i n g V a l u e o f r e s i s t a n c e ( ohm )=+/ )
disp ( G u a r a n t e e v a l u e o f t h e r e s i s t a n c e ( ohm )= )
G1 = Rx + Er_Le ;
G2 = Rx - Er_Le ;
disp ( G1 , G2 , )

Scilab code Exa 3.9 Calculate the percentage limiting error and range of
resistance values
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

// C a l c u l a t e t h e p e r c e n t a g e l i m i t i n g e r r o r and r a n g e
of resistance values
clc ;
disp ( d e c a d e a i s s e t a t 4 0 0 0 ohm , so , e r r o r i n
d e c a d e a= )
Er_a =4000*0.1/100;
disp ( Er_a )
disp ( d e c a d e b i s s e t a t 600 ohm , so , e r r o r i n d e c a d e
b= )
Er_b =600*0.1/100;
disp ( Er_b )
disp ( d e c a d e c i s s e t a t 30 ohm , so , e r r o r i n d e c a d e
c= )
Er_c =30*0.1/100;
disp ( Er_c )
disp ( d e c a d e d i s s e t a t 9 ohm , so , e r r o r i n d e c a d e d
=)
Er_d =9*0.1/100;
disp ( Er_d )
Er_total = Er_a + Er_b + Er_c + Er_d ;
29

16
17
18
19
20
21

Re_le_percentage = Er_total *100/4639;


disp ( Re_le_percentage , P e r c e n t a g e R e l a t i v e l i m i t i n g
e r r o r= )
Range_lower =4639 - Er_total ;
disp ( Range_lower , Lower v a l u e o f r a n g e ( ohm )= )
Range_upper =4639+ Er_total ;
disp ( Range_upper , u p p e r v a l u e o f r a n g e ( ohm )= )

Scilab code Exa 3.10 Calculate the magnitude of power and limiting error
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

// C a l c u l a t e t h e m a g n i t u d e o f power and l i m i t i n g
error
clc ;
F =4.58;
L =397;
R =1202*10^ -9;
t =60;
P =(2* %pi *9.81* F * L * R ) /( t *10^6) ;
disp (P , Magnitude o f power (W)= )
dF_pu =0.02/ F ; // p e r u n i t e r r o r i n f o r c e
dL_pu =1.3/ L ; // p e r u n i t e r r o r i n Length
dR_pu =1/ R ; // p e r u n i t e r r o r i n r e v o l u t i o n
dt_pu =0.5/ t ; // p e r u n i t e r r o r i n t i m e
dP_pu = dF_pu + dL_pu + dR_pu + dt_pu ;
dP_le = dP_pu * P ;
disp ( dP_le , Magnitude o f l i m i t i n g e r r o r i n power (W)
)

Scilab code Exa 3.11 Calculate the magnitude of Force and limiting error
// C a l c u l a t e t h e m a g n i t u d e o f F o r c e and l i m i t i n g
error
2 clc ;
1

30

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

E =200*10^9;
L =25*10^ -3;
b =4.75*10^ -3;
d =0.9*10^ -3;
I =( b * d ^3) /12;
x =2.5*10^ -3;
F =(3* E * I * x ) /( L ^3) ;
disp (F , Magnitude o f F o r c e (N)= )
dE_pu =0/ E ; // p e r u n i t e r r o r i n E
db_pu =0.0075/ b ;
dd_pu =0.0075/ d ;
dx_pu =0.025/ x ;
dL_pu =0.025/ L ;
dF_pu = ( dE_pu + db_pu +3* dd_pu + dx_pu +3* dL_pu ) *10^ -3;
disp ( dF_pu , l i m i t i n g e r r o r i n f o r c e (N)=+/ )

Scilab code Exa 3.12 calculate the power loss and relative error
1
2
3
4
5
6
7
8

// c a l c u l a t e t h e power l o s s and r e l a t i v e e r r o r
clc ;
I =64*10^ -3;
R =3200;
P =( I ^2) * R ;
disp (P , Power (W)= )
Re =2*0.75+0.2;
disp ( Re , R e l a t i v e e r r o r (%)= )

Scilab code Exa 3.13 Calculate the true power as a percentage of measured power
1

// C a l c u l a t e t h e t r u e power a s a p e r c e n t a g e o f
m e a s u r e d power
31

2
3
4
5
6
7
8
9
10

clc ;
I =30.4;
R =0.015;
I_true = I *(1+0.012) ;
R_true = R *(1 -0.003) ;
P_true =( I_true ^2) * R_true ;
P_measured =( I ^2) * R ;
R = P_true *100/ P_measured ;
disp (R , t r u e power a s a p e r c e n t a g e o f m e a s u r e d power
(%)= )

Scilab code Exa 3.14 calculate the total resistance error of each register
and fractional error of total resistance
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

// c a l c u l a t e t h e t o t a l r e s i s t a n c e , e r r o r o f e a c h
r e g i s t e r and f r a c t i o n a l e r r o r o f t o t a l r e s i s t a n c e
clc ;
R1 =250;
R2 =500;
R3 =375;
R_true =1/((1/ R1 ) +(1/ R2 ) +(1/ R3 ) ) ;
disp ( R_true , True v a l u e o f r e s i s t a n c e ( ohm )= )
dR1 = 0.025* R1 ;
dR2 = -0.36* R2 ;
dR3 =0.014* R3 ;
R1_effective = R1 + dR1 ;
R2_effective = R2 + dR2 ;
R3_effective = R3 + dR3 ;
R_effective =1/((1/ R1_effective ) +(1/ R2_effective ) +(1/
R3_effective ) ) ;
disp ( R_effective , E f f e c t i v e v a l u e o f r e s i s t a n c e ( ohm
)= )
Fractional_error =( R_true - R_effective ) / R_true ;
disp ( Fractional_error , F r a c t i o n a l e r r o r )

32

Scilab code Exa 3.15 find the error


1 //
2 clc ;
3 disp ( When a l l
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

t h e c o m p o n en t s have 0% e r r o r t h e n
r e s o n a n t f r e q u e n c y ( Hz ) )
L =160*10^ -6;
C =160*10^ -12;
fr =[1/(2* %pi ) ]*[1/( L * C ) ]^0.5;
disp ( fr )
disp ( When a l l t h e c o m p o n en t s have +10% e r r o r t h e n
r e s o n a n t f r e q u e n c y ( Hz ) )
L_new =(160*10^ -6) +0.1* L ;
C_new =(160*10^ -12) +0.1* C ;
fr_new =[1/(2* %pi ) ]*[1/( L_new * C_new ) ]^0.5;
disp ( fr_new )
error =( fr_new - fr ) / fr ;
disp ( error , e r r o r= )
disp ( When a l l t h e c o m p o n en t s have 10% e r r o r t h e n
r e s o n a n t f r e q u e n c y ( Hz ) )
L_new =(160*10^ -6) -0.1* L ;
C_new =(160*10^ -12) -0.1* C ;
fr_new =[1/(2* %pi ) ]*[1/( L_new * C_new ) ]^0.5;
disp ( fr_new )
error =( fr_new - fr ) / fr ;
disp ( error , e r r o r= )

Scilab code Exa 3.16 calculate the Volume and relative error
1 // c a l c u l a t e
2 clc ;
3 L =250;

t h e Volume and r e l a t i v e e r r o r

33

4 d =50;
5 V =(( %pi /4) * d ^2) * L ;
6 disp (V , Volume (mm3)= )
7 Re =2*0.2 -0.5;
8 disp ( Re , R e l a t i v e e r r o r (%)= )

Scilab code Exa 3.17 calculate the per unit change in the value of spring
for different temperature ranges
1
2
3
4
5
6
7
8
9
10
11
12

// c a l c u l a t e t h e p e r u n i t c h a n g e i n t h e v a l u e o f
spring f o r d i f f e r e n t temperature ranges
clc ;
dG_pu = -240*10^ -6;
dD_pu =11.8*10^ -6;
disp ( f o r t e m p e r a t u r e c h a n g e o f 20 d e g r e e C t o 50
d e g r e e C (%) = )
d_th =30;
dK_pu =( dG_pu + dD_pu ) * d_th *100;
disp ( dK_pu )
disp ( f o r t e m p e r a t u r e c h a n g e o f 20 d e g r e e C t o 50
d e g r e e C (%) = )
d_th = -70;
dK_pu =( dG_pu + dD_pu ) * d_th *100;
disp ( dK_pu )

Scilab code Exa 3.18 Calculate apparent resistance actual resistance and
error
// C a l c u l a t e a p p a r e n t r e s i s t a n c e , a c t u a l r e s i s t a n c e
and e r r o r
2 clc ;
3 Et =100;
4 It =5*10^ -3;
1

34

5 Rt = Et / It ;
6 disp ( Rt , a p p a r e n t v a l u e o f r e s i s t a n c e ( ohm )= )
7 Rv =1000*150;
8 Rx = Rt * Rv /( Rv - Rt ) ;
9 disp ( Rx , t r u e v a l u e o f r e s i s t a n c e ( ohm ) )
10 Er_percentage =[( Rt - Rx ) / Rx ]*100;
11 disp ( Er_percentage , p e r c e n t a g e e r r o r= )

Scilab code Exa 3.19 Calculate apparent resistance actual resistance and
error
1
2
3
4
5
6
7
8
9
10
11

// C a l c u l a t e a p p a r e n t r e s i s t a n c e , a c t u a l r e s i s t a n c e
and e r r o r
clc ;
Et =40;
It =800*10^ -3;
Rt = Et / It ;
disp ( Rt , a p p a r e n t v a l u e o f r e s i s t a n c e ( ohm )= )
Rv =1000*150;
Rx = Rt * Rv /( Rv - Rt ) ;
disp ( Rx , t r u e v a l u e o f r e s i s t a n c e ( ohm ) )
Er_percentage =[( Rt - Rx ) / Rx ]*100;
disp ( Er_percentage , p e r c e n t a g e e r r o r= )

Scilab code Exa 3.20 Calculate the error and percentage error in the measurement of deflection
1
2
3
4
5

// C a l c u l a t e t h e e r r o r and p e r c e n t a g e e r r o r i n t h e
measurement o f d e f l e c t i o n
clc ;
l =0.2;
E =200*10^9;
b =20*10^ -3;
35

6
7
8
9
10
11
12
13
14
15
16

d =5*10^ -3;
D =(4* l ^3) /( E * b * d ^3) ;
F =1*9.81;
x_true = D * F ;
disp ( x_true , True v a l u e o f d e f l e c t i o n )
x_indicated = D *10.31/(1+.1* D ) ;
disp ( x_indicated , I n d i c a t e d v a l u e o f d e f l e c t i o n )
Er = x_indicated - x_true ;
disp ( Er , e r r o r= )
Er_percentage = Er *100/ x_true ;
disp ( Er_percentage , P e r c e n t a g e e r r o r= )

Scilab code Exa 3.21 to find the mean deviations from the mean Average
deviation standard deviation and variance
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

// t o f i n d t h e mean , d e v i a t i o n s from t h e mean , A v e r a g e


d e v i a t i o n , s t a n d a r d d e v i a t i o n and v a r i a n c e
clc ;
x =[532 548 543 535 546 531 543 536];
X = sum ( x ) ;
n =8;
a =0;
Mean = X / n ;
disp ( X /n , mean ( kHZ ) ) ;
for i =1: n ,
d ( i ) = x ( i ) - Mean
disp ( d ( i ) , d e v i a t i o n s = )
a = a +( abs ( d ( i ) ) )
end
d_average = a / n ;
disp ( d_average , A v e r a g e d e v i a t i o n ( kHz )= )
d_2 = sum ( d ^2) ;
s = sqrt ( d_2 /( n -1) )
disp (s , s t a n d a r d d e v i a t i o n ( kHz ) ) ;
36

20 V = s ^2;
21 disp (V , v a r a i n c e ( kHZ ) 2= )

Scilab code Exa 3.22 to find the mean standard deviation probable error
and range
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

// t o f i n d t h e mean , s t a n d a r d d e v i a t i o n , p r o b a b l e
e r r o r and r a n g e
clc ;
x =[41.7 42 41.8 42 42.1 41.9 42 41.9 42.5 41.8];
X = sum ( x ) ; disp ( X ) ;
d =[ -.27 .03 -.17 .03 .13 -.07 .03 -.07 .53 -.17];
d_2 = sum ( d ^2) ;
n =10;
disp ( X /n , mean l e n g t h ( deg C) ) ;
disp ( sqrt ( d_2 / n ) , s t a n d a r d d e v i a t i o n ( i f d a t a i s
i n f i n i t e ) ( deg C) ) ;
disp ( sqrt ( d_2 /( n -1) ) , s t a n d a r d d e v i a t i o n ( deg C) ) ;
r1 =.6745* sqrt ( d_2 /( n -1) ) ;
disp ( r1 , p r o b a b l e e r r o r o f 1 r e a d i n g ( deg C) ) ;
disp ( r1 / sqrt (n -1) , p r o b a b l e e r r o r o f mean ( deg C) ) ;
disp ( max ( x ) - min ( x ) , r a n g e ( deg C) ) ;

Scilab code Exa 3.23 to find the arithematic mean maen deviation standard deviation prpobable error of 1 reading standard deviation and probable
error of mean standard deviation of standard deviation
1

// t o f i n d t h e a r i t h e m a t i c mean , maen d e v i a t i o n ,
standard deviation , prpobable e r r o r of 1 reading ,
s t a n d a r d d e v i a t i o n and p r o b a b l e e r r o r o f mean ,
standard deviation of standard deviation

37

3
4
5
6
7
8
9
10
11
12
13
14

clc ;
T =[397 398 399 400 401 402 403 404 405];
f =[1 3 12 23 37 16 4 2 2];
Tf = sum ( abs ( T .* f ) ) ;
disp ( Tf / sum ( f ) , mean temp ( deg C) ) ;
d =[ -3.78 -2.78 -1.78 -.78 .22 1.22 2.22 3.22 4.22];
disp ( sum ( f .* d ) / sum ( f ) , mean d e v i a t i o n ( deg C) ) ;
disp ( sqrt ( sum ( f .* d ^2) / sum ( f ) ) , s t a n d a r d d e v i a t i o n (
deg C) ) ;
disp (.6745* sqrt ( sum ( f .* d ^2) / sum ( f ) ) , p r o b a b l e e r r o r
o f 1 r e a d i n g ( deg C) ) ;
disp ((.6745* sqrt ( sum ( f .* d ^2) / sum ( f ) ) ) / sqrt ( sum ( f ) ) ,
p r o b a b l e e r r o r o f mean ( deg C) ) ;
disp (( sqrt ( sum ( f .* d ^2) / sum ( f ) ) ) / sqrt ( sum ( f ) ) ,
s t a n d a r d d e v i a t i o n o f mean ( deg C) ) ;
disp (( sqrt ( sum ( f .* d ^2) / sum ( f ) ) ) / sqrt ( sum ( f ) *2) ,
s t a n d a r d d e v i a t i o n o f s t a n d a r d d e v i a t i o n ( deg C) )
;

Scilab code Exa 3.24 to find probable no of resistors


1
2
3
4
5
6
7

// t o f i n d p r o b a b l e no o f r e s i s t o r s

clc ;
x =.15;
// d e v i a t i o n
o =.1;
// s t a n d a r d d e v i a t i o n
t=x/o;
A =.4432
// a r e a u n d e r g a u s s i a n c u r v e c o r r e s p o n d i n g
to t
8 n =2* A *1000;
9 disp ( floor ( n ) , no o f r e s i s t o r s ) ;

Scilab code Exa 3.25 to find no of 100 rsding exceed 30mm


38

1
2
3
4
5
6
7
8

// t o f i n d no o f 100 r s d i n g e x c e e d 30mm

clc ;
x =30 -26.3;
// mean v a l u e 2 6 . 3
r =2.5;
o = r /.6745;
t=x/o;
A =.3413; // a r e a u n d e r g a u s s i a n c u r v e c o r r e s p o n d i n g t o
t
9 n =2* A *100;
10 nn =100 - floor ( n ) ;
11 disp ( nn /2 , no o f r e a d i n g s e x c e e d ) ;

Scilab code Exa 3.26 to find no of rods of desired length


1
2
3
4
5
6
7
8
9
10
11
12
13

// t o f i n d no o f r o d s o f d e s i r e d l e n g t h
clc ;
n =25000;
// no o f r o d s
n1 =12500; // l e n g t h >10mm
n2 =2000;
// l e n g t h > 1 0 . 2 5
a = n1 - n2 ;
// 10< l e n g t h < 1 0 . 2 5
p=a/n;
t =1.41;
// u s i n g p
t1 = t *2;
p1 =.4975;
b = p1 * n ;
// 9.5 < l e n g t h <10
disp ( a + floor ( b ) , t o t a l no o f r o d s ) ;

Scilab code Exa 3.27 to find standard deviation and probability of error
1

// t o f i n d s t a n d a r d d e v i a t i o n and p r o b a b i l i t y o f
error
39

2
3
4
5
6
7
8
9
10
11
12

clc ;
p =.2;
x =.8;
t =.5025;
sd = x / t ;
disp ( sd , s t n d a r d d e v i a t i o n ) ;
x =1.2;
t = x / sd ;
p =2*.2743;
disp (p , p r o b a b i l i t y o f e r r o r ) ;

Scilab code Exa 3.28 to find no of expected readings


1
2
3
4
5
6
7
8
9
10

// t o f i n d no o f e x p e c t e d r e a d i n g s
clc ;
x =20;
h =0.04;
sd =1/( sqrt (2) * h ) ;
t = x / sd ;
P =.3708;
disp ( ceil (2* P * x ) , no o f e x p e c t e d r e a d i n g s ) ;

Scilab code Exa 3.29 to calculate precision index of instrument


1
2
3
4
5
6

// t o c a l c u l a t e p r e c i s i o n i n d e x o f i n s t r u m e n t
clc ;
t =.675;
x =2.4;
sd = x / t ;
40

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

h =1/( sqrt (2) * sd ) ;


disp (h , p r e c i s i o n i n d e x ) ;
t =(50 -44) / sd ;
p =.45;
n =8*30;
// s e p t month no o f m e a s u r e m e n t s
a =((.5 - p ) * n ) ;
disp (a , no o f f a l s e a l a r m s ) ;
rn = a /2;
// r e d u c e d no o f f a l s e a l a r m s
p1 = rn / n ;
P =.5 - p1 ;
t =1.96;
sd =(50 -44) / t ;
h =1/( sqrt (2) * sd ) ;
disp (h , p r e c i s i o n i n d e x ) ;

Scilab code Exa 3.30 to find confidence interval for given confidence levels
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

// t o f i n d c o n f i d e n c e i n t e r v a l f o r g i v e n c o n f i d e n c e
levels
clc ;
cl =[.5 .9 .95 .99];
s =.22;
d =[.7 1.83 2.26 3.25];
function [ a ]= ci ( b )
a=s*b;
endfunction
CI (1) = ci ( d (1) ) ;
CI (2) = ci ( d (2) ) ;
CI (3) = ci ( d (3) ) ;
CI (4) = ci ( d (4) ) ;
disp ( CI , c o n f i d e n c e i n t e r v a l ) ;
41

Scilab code Exa 3.31 to point out the reading that can be rejected by
chavenets criterion
1

// t o p o i n t o u t t h e r e a d i n g t h a t can be r e j e c t e d by
chavenets c r i t e r i o n

2
3 clc ;
4 x =[5.3 5.73 6.77 5.26 4.33 5.45 6.09 5.64 5.81
5

5.75]*10^ -3;
d =[ -.313 .117 1.157 -.353 -1.283 -.163 .477 .027
.197 .137]*10^ -3;
n =10;
X = sum ( x ) / n ;
s = sqrt ( sum ( d ^2) /( n -1) ) ;
a = abs ( d ) / s ; disp ( a ) ;

6
7
8
9
10
11
12 for i =1:10 ,
13
14 if a ( i ) >1.96 then
15
disp ( x ( i ) , r e j e c t e d
16 end
17
end

v a l u e );

Scilab code Exa 3.32 calculate standard deviation


1 // c a l c u l a t e s t a n d a r d d e v i a t i o n
2
3 clc ;
4 x =[.9 2.3 3.3 4.5 5.7 6.7];
5 y =[1.1 1.6 2.6 3.2 4 5];

42

6 n =6;
7 a =(( n * sum ( x .* y ) -( sum ( x ) * sum ( y ) ) ) /(( sum ( x ^2) * n ) - sum ( x

) ^2) ) ;
8 b =(( sum ( y ) * sum ( x ^2) -( sum ( x ) * sum ( x .* y ) ) ) /(( sum ( x ^2) * n
) - sum ( x ) ^2) ) ;
9
10
11
12
13
14
15
16

sdy = sqrt ((1/ n ) * sum (( a * x +b - y ) ^2) ) ;


sdx = sdy / a ;
sa = sqrt ( n /( n * sum ( x ^2) - sum ( x ) ^2) ) * sdy ;
sb = sqrt ( sum ( x ^2) /( n * sum ( x ^2) - sum ( x ) ^2) ) * sdy ;
disp ( sa , s a ) ;
disp ( sb , s b ) ;

Scilab code Exa 3.34 determine value of total current considering errors
as limiting errors ans as standrd deviations
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

// d e t e r m i n e v a l u e o f t o t a l c u r r e n t c o n s i d e r i n g
e r r o r s as l i m i t i n g e r r o r s ans as standrd
deviations
clc ;
I1 =200;
I2 =100;
dI1 =2;
dI2 =5;
I = I1 + I2 ;
dI =(( I1 / I ) *( dI1 / I1 ) +( I2 / I ) *( dI2 / I2 ) ) ;
disp ( e r r o r c o n s i d e r e d a s l i m i t i n g e r r o r s ) ;
disp (I , I ) ;
disp ( dI *I , d I ) ;
sdI = sqrt ( dI1 ^2+ dI2 ^2) ;
disp ( e r r o r c o n s i d e r e d a s s t a n d a r d d e v i a t i o n s ) ;
disp (I , I ) ;
disp ( sdI , s d I ) ;
43

Scilab code Exa 3.35 determine probable error in the computed value of
resistnce
1
2
3
4
5
6
7
8
9
10
11

// d e t e r m i n e p r o b a b l e e r r o r i n t h e computed v a l u e o f
resistnce
clc ;
r_V =12;
I =10;
r_Rv = r_V / I ;
V =100;
r1 =2;
r_Ri = V * r1 / I ^2;
r_R = sqrt ( r_Rv ^2+ r_Ri ^2) ;
disp ( r_R , r R ) ;

Scilab code Exa 3.37 to find Cq and its possible errors


1
2
3
4
5
6
7
8
9
10
11
12
13

// t o f i n d Cq and i t s

possible errors

clc ;
d =12.5;
A =( %pi /4) * d ^2*10^ -6;
W =392;
t =600;
p =1000;
g =9.81;
h =3.66;
Cq = W /( t * p * A * sqrt (2* g * h ) ) ;
disp ( Cq , Cq ) ;
dW =.23/ W ;
44

14
15
16
17
18
19
20
21
22
23
24

dt =2/ t ;
dp =.1/100;
dA =2*.002;
dg =.1/100;
dh =.003/ h ;
dd =.002;
dCq = Cq *( dW + dt + dp + dA + dg /2+ dh /2) ;
disp ( dCq *100/ Cq , %age a b s o l u t e e r r o r ) ;
sdCq = Cq * sqrt ( dW ^2+ dt ^2+ dp ^2+4* dd ^2+.25*( dg ^2+ dh ^2) ) ;
disp ( sdCq *100/ Cq , %age s t a n d a r d d e v i a t i o n e r r o r ) ;

Scilab code Exa 3.38 calculate power disipated and uncertaainity in power
1
2
3
4
5
6
7
8
9
10

// c a l c u l a t e power d i s i p a t e d and u n c e r t a a i n i t y i n
power
clc ;
V =110.2;
I =5.3;
P = V * I ; disp (P , power (W) d i s s i p a t e d ) ;
w_v =.2;
w_i =0.06;
dp = sqrt (( w_v * I ) ^2+( w_i * V ) ^2) ;
disp ( dp *100/ P , u n c e r t a i n i t y i n power (%) ) ;

Scilab code Exa 3.39 to find uncertainity in combined resistance in both


series and in parrallel
1

// t o f i n d u n c e r t a i n i t y i n combined r e s i s t a n c e i n
b o t h s e r i e s and i n p a r r a l l e l

2
3 clc ;

45

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

R1 =100;
R2 =50;
wR1 =.1;
wR2 =0.03;
disp ( s e r i e s conn ) ;
R = R1 + R2 ; disp (R , r e s i s t a n c e ( ohm ) ) ;
dR1 =1;
dR2 =1;
wR = sqrt (( dR1 * wR1 ) ^2+( dR2 * wR2 ) ^2) ; disp ( wR ,
u n c e r t a i n i t y i n r e s i s t a n c e ( ohm ) ) ;
disp ( p a r r a l l e l conn ) ;
R = R1 * R2 *( R1 + R2 ) ^ -1; disp (R , r e s i s t a n c e ( ohm ) ) ;
dR1 =( R2 /( R1 + R2 ) ) -(( R1 * R2 ) /( R1 + R2 ) ^2) ;
dR2 =( R1 /( R1 + R2 ) ) -(( R1 * R2 ) /( R1 + R2 ) ^2) ;
wR = sqrt (( dR1 * wR1 ) ^2+( dR2 * wR2 ) ^2) ; disp ( wR ,
u n c e r t a i n i t y i n r e s i s t a n c e ( ohm ) ) ;

Scilab code Exa 3.40 to calculate uncertainity in measurement


1
2
3
4
5
6
7
8

// t o c a l c u l a t e u n c e r t a i n i t y i n measurement

clc ;
l =150;
dl =0.01;
b =50;
wA = l * dl ;
disp ( when no u n c e r t a i n i t y i n measurement o f l e n g t h
);
9 disp ( wA , u n c e r t a i n i t y i n measurement o f a r e a (mm) ) ;
10
11 disp ( when no c e r t a i n i t y i n measurement o f
12 wA =1.5*1.5;
13 wB =0.01;
14 wL = sqrt (( wA ^2 -( l * wB ) ^2) / b ^2) ;

46

l e n g t h );

15

disp ( wL , u n c e r t a i n i t y i n measurement o f l e n g t h (m) ) ;

Scilab code Exa 3.41 to calculate uncertainity in power


1
2
3
4
5
6
7
8
9
10
11
12
13
14

// t o c a l c u l a t e u n c e r t a i n i t y i n power
clc ;
E =100;
dE =.01;
I =10;
dI =0.01;
R =10;
dR =.01;
dP = sqrt (4* dE ^2+ dR ^2) *100;
//P=E2/R
disp ( dP , %age u n c e r t a i n i t y i n power measurement ) ;
dP = sqrt ( dE ^2+ dI ^2) *100;
//P=E I
disp ( dP , %age u n c e r t a i n i t y i n power measurement ) ;

47

Chapter 4
Dynamic Characteristics of
Instruments and Measurement
systems

Scilab code Exa 4.1 calculating the temperature


1
2
3
4
5
6
7

// c a l c u l a t i n g t h e t e m p e r a t u r e a f t e r 1 . 5 s
clc ;
th0 =100;
t =1.5;
tc =3.5;
th = th0 *[1 - exp ( - t / tc ) ];
disp ( th , t e m p e r a t u r e a f t e r 1 . 5 s ( d e g r e e C) )

Scilab code Exa 4.2 calculate time to read half of the temperature difference
// c a l c u l a t e t i m e t o r e a d h a l f o f t h e t e m p e r a t u r e
difference
2 clc ;
1

48

3
4
5
6
7

tc =10/5;
th =1;
th0 =2;
t = - tc * log (1 -( th / th0 ) ) ;
disp (t , Time t o r e a d h a l f o f t h e t e m p e r a t u r e
difference ( s ) )

Scilab code Exa 4.4 Calculate the temperature after 10s


1
2
3
4
5
6
7
8

// C a l c u l a t e t h e t e m p e r a t u r e a f t e r 10 s
clc ;
th0 =25;
thi =150;
t =10;
tc =6;
th = th0 +( thi - th0 ) *[ exp ( - t / tc ) ];
disp ( th , t h e t e m p e r a t u r e a f t e r 10 s ( d e g r e e C) )

Scilab code Exa 4.5 Calculate the value of resistance after 15s
1
2
3
4
5
6
7
8

// C a l c u l a t e t h e v a l u e o f r e s i s t a n c e a f t e r 15 s
clc ;
R0 =29.44;
Rs =100;
t =15;
tc =5.5;
R_15 = Rs + R0 *[1 - exp ( - t / tc ) ];
disp ( R_15 , v a l u e o f r e s i s t a n c e a f t e r 15 s ( ohm ) )

Scilab code Exa 4.6 Calculate the depth after one hour
49

1
2
3
4
5
6
7
8
9
10
11
12
13

// C a l c u l a t e t h e d e p t h a f t e r one h o u r
clc ;
Qm =0.16*10^ -3;
Hin =1.2;
K1 = Qm /( Hin ) ^0.5;
Qo =0.2*10^ -3;
Ho =( Qo / K1 ) ^2;
R = Hin / Qm ;
C =0.1;
tc = R * C ;
t =3600;
H = Ho +( Hin - Ho ) * exp ( - t / tc ) ;
disp (H , t h e d e p t h a f t e r one h o u r (m) )

Scilab code Exa 4.8 Calculate time constant


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

// C a l c u l a t e t i m e c o n s t a n t
clc ;
S =3.5;
Ac =( %pi /4) *(0.25) ^2;
alpha =0.18*10^ -3;
Vb = S * Ac / alpha ;
disp ( Vb , volume o f b u l b (mm2) )
Rb =[( Vb / %pi ) *(3/4) ]^(1/3) ;
Ab =4* %pi * Rb ^2;
D =13.56*10^3;
s =139;
H =12;
tc =( D * s * Vb *10^ -9) /( H * Ab *10^ -6) ;
disp ( tc , t i m e c o n s t a n t ( s ) )

Scilab code Exa 4.9 Calculate the temperature after 10s


50

1 // C a l c u l a t e t h e t i m e c o n s t a n t
2 ess =5;
3 A =0.1;
4 tc = ess / A ;
5 disp ( tc , t i m e c o n s t a n t ( s ) )

Scilab code Exa 4.10 Calculate the temperature at a depth of 1000 m


1
2
3
4
5
6

// C a l c u l a t e t h e t e m p e r a t u r e a t a d e p t h o f 1 0 0 0 m
clc ;
th0 =20;
t =2000;
thr = th0 -0.005*( t -50) -0.25* exp ( - t /50) ;
disp ( thr , t e m p e r a t u r e a t a d e p t h o f 1 0 0 0 m ( d e g r e e C
) )

Scilab code Exa 4.11 Calculate the value of resistance at different values
of time
1
2
3
4
5
6
7
8
9
10
11
12
13

// C a l c u l a t e t h e v a l u e o f r e s i s t a n c e a t d i f f e r e n t
v a l u e s o f time
clc ;
Gain =0.3925;
T =75;
p_duration = Gain * T ;
tc =5.5;
Rin =100;
t =1;
Rt = p_duration *(1 - exp ( - t / tc ) ) + Rin ;
disp ( Rt , V a l u e o f r e s i s t a n c e a f t e r 1 s ( ohm )= )
t =2;
Rt = p_duration *(1 - exp ( - t / tc ) ) + Rin ;
disp ( Rt , V a l u e o f r e s i s t a n c e a f t e r 2 s ( ohm )= )
51

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

t =3;
Rt = p_duration *(1 - exp ( - t / tc ) ) + Rin ;
disp ( Rt , V a l u e o f r e s i s t a n c e a f t e r 3 s ( ohm )= )
R_inc = Rt - Rin ;
t =5;
Rt =( R_inc ) *[ exp ( -(t -3) /(5.5) ) ]+ Rin ;
disp ( Rt , V a l u e o f r e s i s t a n c e a f t e r 5 s ( ohm )= )
t =10;
Rt =( R_inc ) *[ exp ( -(t -3) /(5.5) ) ]+ Rin ;
disp ( Rt , V a l u e o f r e s i s t a n c e a f t e r 10 s ( ohm )= )
t =20;
Rt =( R_inc ) *[ exp ( -(t -3) /(5.5) ) ]+ Rin ;
disp ( Rt , V a l u e o f r e s i s t a n c e a f t e r 20 s ( ohm )= )
t =30;
Rt =( R_inc ) *[ exp ( -(t -3) /(5.5) ) ]+ Rin ;
disp ( Rt , V a l u e o f r e s i s t a n c e a f t e r 30 s ( ohm )= )

Scilab code Exa 4.12 calculate the value of damping constant and frequency of damped oscillations
1
2
3
4
5
6
7
8
9
10
11

// c a l c u l a t e t h e v a l u e o f damping c o n s t a n t and
f r e q u e n c y o f damped o s c i l l a t i o n s
clc ;
M =8*10^ -3;
K =1000;
wn =( K / M ) ^0.5;
disp ( f o r c r i t i c a l l y damped s y s t e m e t a =1 )
B =2*( K * M ) ;
disp (B , Damping c o n s t a n t f o r c r i t i c a l l y damped
s y s t e m (N/ms1)= )
eta =0.6;
wd = wn *(1 - eta ^2) ^0.5;
disp ( wd , f r e q u e n c y o f damped o s c i l l a t i o n s ( r a d / s )= )

52

Scilab code Exa 4.13 Calculate damping ratio natural frequency frequency
of damped oscillations time constant and steady state error for ramp signal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

// C a l c u l a t e damping r a t i o , n a t u r a l f r e q u e n c y ,
f r e q u e n c y o f damped o s c i l l a t i o n s , t i m e c o n s t a n t
// and s t e a d y s t a t e e r r o r f o r ramp s i g n a l o f 5V/ s
clc ;
K =(40*10^ -6) /( %pi /2) ;
J =0.5*10^ -6;
B =5*10^ -6;
eta = B /(2*( K * J ) ^0.5) ;
disp ( eta , damping r a t i o = )
wn =( K / J ) ^0.5;
disp ( wn , n a t u r a l f r e q u e n c y ( r a d / s e c ) )
wd = wn *(1 -( eta ) ^2) ^0.5;
disp ( wd , f r e q u e n c y o f damped o s c i l l a t i o n s ( r a d / s ) )
tc =1/ wn ;
disp ( tc , t i m e c o n s t a n t ( s ) )
ess =2* eta / wn ;
disp ( f o r a ramp i n p u t o f 5V, s t e a d y s t a t e e r r o r (V)
=)
ess =5*2* eta / wn ;
disp ( ess , )
T_lag =2* eta * tc ;
disp ( T_lag , Time l a g ( s ) )

Scilab code Exa 4.14 Calculate the natural frequency


1 // C a l c u l a t e t h e n a t u r a l
2 clc ;
3 wn =2* %pi *30;

frequency

53

4
5
6
7
8
9
10
11
12
13
14

disp ( f o r a f r e q u e n c y o f 30 Hz wn=(K/M+510 3)
0 . 5 . . . . . . . . . ( i ) );
disp ( But wn=(K/M) 0 . 5 . . . . . . . . . ( i i ) ) ;
disp ( f o r a f r e q u e n c y o f 25 Hz wn=(K/M
+510 3+510 3) 0 . 5 . . . . . . . . . ( i i i ) )
disp ( on s o l v i n g ( i ) , ( i i ) and ( i i i ) )
M =6.36*10^ -3;
K =403.6;
disp (M , M= )
disp (K , K= )
wn =( K / M ) ^0.5;
f = wn /(2* %pi ) ;
disp (f , n a t u r a l f r e q u e n c y ( Hz ) )

Scilab code Exa 4.15 Calculate natural frequency and setteling time
1
2
3
4
5
6
7
8
9

// C a l c u l a t e n a t u r a l f r e q u e n c y and s e t t e l i n g t i m e
clc ;
K =60*10^3;
M =30;
wn =( K / M ) ^0.5;
disp ( wn , n a t u r a l f r e q u e n c y ( r a d / s e c ) )
eta =0.7;
ts =4/( eta * wn ) ;
disp ( ts , s e t t e l i n g t i m e ( s ) )

Scilab code Exa 4.16 Calculate time lag and ratio of output and input
1 // C a l c u l a t e t i m e l a g and r a t i o o f o u t p u t and i n p u t
2 clc ;
3 disp ( when t i m e p e r i o d i s 600 s )
4 w =2* %pi /600;
5 tc =60;

54

6
7
8
9
10
11
12
13
14
15
16

T_lag =(1/ w ) * atan ( w * tc ) ;


disp ( T_lag , t i m e l a g ( s )= )
M =1/((1+( w * tc ) ^2) ^0.5) ;
disp (M , r a t i o o f o u t p u t and i n p u t= )
disp ( when t i m e p e r i o d i s 120 s )
w =2* %pi /120;
tc =60;
T_lag =(1/ w ) * atan ( w * tc ) ;
disp ( T_lag , t i m e l a g ( s )= )
M =1/((1+( w * tc ) ^2) ^0.5) ;
disp (M , r a t i o o f o u t p u t and i n p u t= )

Scilab code Exa 4.17 Calculate the maximum allowable time constant and
phase shift
1
2
3
4
5
6
7
8
9
10
11
12

// C a l c u l a t e t h e maximum a l l o w a b l e t i m e c o n s t a n t and
phase s h i f t
clc ;
M =1 -0.05;
w =2* %pi *100;
tc ={[(1/ M ^2) -1]/( w ^2) }^0.5;
disp ( tc , maximum a l l o w a b l e t i m e c o n s t a n t ( s ) )
disp ( p h a s e s h i f t a t 50 Hz ( d e g r e e )= )
ph =[ - atan (2* %pi *50* tc ) ]*(180/ %pi ) ;
disp ( ph , )
disp ( p h a s e s h i f t a t 100 Hz ( d e g r e e )= )
ph =[ - atan (2* %pi *100* tc ) ]*(180/ %pi ) ;
disp ( ph ,)

Scilab code Exa 4.18 Calculate maximum value of indicated temperature


and delay time

55

1
2
3
4
5
6
7
8
9
10
11
12

// C a l c u l a t e maximum v a l u e o f i n d i c a t e d t e m p e r a t u r e
and d e l a y t i m e
clc ;
T =120;
w =2* %pi / T ;
tc1 =40;
tc2 =20;
M =[1/((1+( w * tc1 ) ^2) ^0.5) ]*[1/((1+( w * tc2 ) ^2) ^0.5) ];
M_temp = M *10;
disp ( M_temp , maximum v a l u e o f i n d i c a t e d t e m p e r a t u r e
( d e g r e e C) )
ph =[{ atan ( w * tc1 ) + atan ( w * tc2 ) }];
T_lag = ph / w ;
disp ( T_lag , Time l a g ( s ) )

Scilab code Exa 4.19 Find the output


1 // Find t h e o u t p u t
2 clc ;
3 disp ( when t c = 0 . 2 ) ;
4 d i s p ( output =1/(1+(2*0.2) ^2) ^0.5] sin [2 t - atan (2*0.2)

]+3/(1+(2*0.2) ^2) ^0.5] sin [20 t - atan (20*0.2) ] )


disp ( on s o l v i n g
o u t p u t =0.93 s i n ( 2 t 2 1 . 8 ) + 0 . 0 7 3
s i n ( 2 0 t 76) )
6 disp ( when t c = 0 . 0 0 2 ) ;
7 d i s p ( output =1/(1+(2*0.002) ^2) ^0.5] sin [2 t - atan
(2*0.002) ]+3/(1+(2*0.002) ^2) ^0.5] sin [20 t - atan
(20*0.002) ] )
8 disp ( on s o l v i n g
o u t p u t= 1 s i n ( 2 t 0 . 2 3 ) +0.3 s i n ( 2 0 t
2.3) )

Scilab code Exa 4.20 Calculate maximum and minimum value of indicated temperature phase shift time lag
56

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

// C a l c u l a t e maximum and minimum v a l u e o f i n d i c a t e d


temperature , phase s h i f t , time l a g
clc ;
T_max =640;
T_min =600;
T_mean =( T_max + T_min ) /2;
Ai = T_mean - T_min ;
w =2* %pi /80;
tc =10;
Ao = Ai /{(1+( w * tc ) ^2) }^0.5;
T_max_indicated = T_mean + Ao ;
disp ( T_max_indicated , Maximum v a l u e o f i n d i c a t e d
t e m p e r a t u r e ( d e g r e e C)= )
T_min_indicated = T_mean - Ao ;
disp ( T_min_indicated , Minimum v a l u e o f i n d i c a t e d
t e m p e r a t u r e ( d e g r e e C)= )
ph = - atan ( w * tc ) ;
Time_lag = - ph / w ;
disp ( Time_lag , Time l a g ( s ) )

Scilab code Exa 4.21 determine damping ratio


1
2
3
4
5
6
7
8
9
10

// d e t e r m i n e damping r a t i o
clc ;
w =2;
K =1.5;
J =200*10^ -3;
wn =( K / J ) ^0.5;
u = w / wn ;
M =1.1;
eta =[{[1/( M ^2) ] -[(1 - u ^2) ^2]}/(2* u ) ^2]^0.5;
disp ( eta , damping r a t i o = )

57

Scilab code Exa 4.22 Calculate the frequency range


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

// C a l c u l a t e t h e f r e q u e n c y r a n g e
clc ;
eta =0.6;
fn =1000;
M =1.1;
disp ( M= 1 /[ [ (1 u 2 ) 2 ] + ( 2 u e t a ) 2 ] 0 . 5 ; . . . . . . . . . . (
i ) )
disp ( on s o l v i n g u 4 0.5 u 2+0.173=0 )
disp ( t h e a b o v e e q u a t i o n g i v e s i m a g i n a r y v a l u e s f o r
f r e q u e n c y s o f o r e t a =0.6 t h e o u t p u t i s n o t 1 . 1 )
disp ( Now l e t M= 0 . 9 , on s o l v i n g e q u a t i o n ( i ) we have
)
disp ( u 4 0.56 u 2 0.234=0 )
disp ( on s o l v i n g u = 0 . 9 1 6 )
u =0.916;
f = u * fn ;
disp (f , maximum v a l u e o f r a n g e ( Hz )= )
disp ( So , t h e r a n g e o f t h e f r e q u e n c y i s from 0 t o
916 Hz )

Scilab code Exa 4.23 determine the error


1
2
3
4
5
6
7
8
9

// d e t e r m i n e t h e e r r o r
clc ;
w =6;
wn =4;
u = w / wn ;
eta =0.66;
M =1/{[(1 - u ^2) ^2]+(2* eta * u ) ^2}^0.5;
Error =( M -1) *100;
disp ( Error , e r r o r (%)= )

58

Chapter 5
Primary Sensing Elements and
Transducers

Scilab code Exa 5.1 Calculate the deflection at center


1
2
3
4
5
6
7
8
9
10
11
12

// C a l c u l a t e t h e d e f l e c t i o n a t c e n t e r
clc ;
D =15*10^ -3;
P =300*10^3;
sm =300*10^6;
t =[3* D ^2* P /(16* sm ) ]^0.5;
disp (t , t h i c k n e s s (m)= )
P =150*10^3;
v =0.28;
E =200*10^9;
dm =3*(1 - v ^2) * D ^4* P /(256* E * t ^3) ;
disp ( dm , d e f l e c t i o n a t c e n t e r f o r P r e s s u r e o f 150
kN/m2(m)= )

Scilab code Exa 5.2 Calculate the angle of twist

59

1
2
3
4
5
6
7

// C a l c u l a t e t h e a n g l e o f t w i s t
clc ;
T =100;
G =80*10^9;
d =2*15*10^ -3;
th =16* T /( %pi * G * d ^3)
disp ( th , a n g l e o f t w i s t ( r a d )= )

Scilab code Exa 5.3 Calculate the Torque


1
2
3
4
5
6
7
8
9
10

// C a l c u l a t e t h e Torque
clc ;
E =110*10^9;
t =0.073*10^ -3;
b =0.51*10^ -3;
l =370*10^ -3;
th = %pi /2;
T =( E * b * t ^3) * th /(12* l ) ;
disp (T , C o n t r o l l i n g t o r q u e (Nm)= )

Scilab code Exa 5.4 Calculating the displacement and resolution of the
potentiometer
1
2
3
4
5
6
7
8

// C a l c u l a t i n g t h e d i s p l a c e m e n t and r e s o l u t i o n o f t h e
potentiometer
clc ;
Rnormal =10000/2;
Rpl =10000/50;
Rc1 = Rnormal -3850;
Dnormal = Rc1 / Rpl ;
disp ( Dnormal , D i s p l a c e m e n t (mm)= )
Rc2 = Rnormal -7560;
60

9
10
11

Dnormal = Rc2 / Rpl ;


disp ( Dnormal , D i s p l a c e m e n t (mm)= )
disp ( s i n c e one d i s p l a c e m e n t i s p o s i t i v e and o t h e r
i s n e g a t i v e s o two d i s p l a c e m e n t s a r e i n t h e
opposite direction )
12 Re =10*1/200;
13 disp ( Re , R e s o l u t i o n (mm)= )

Scilab code Exa 5.5 plot the graph of error versus K


1 // p l o t t h e g r a p h o f e r r o r v e r s u s K
2 clc ;
3 K =[0
0.25
0.5
0.75
1];
4 V =[0
-0.174
-0.454
-0.524
5 plot (K , V )

0];

Scilab code Exa 5.6 Calculating the output voltage


1
2
3
4
5
6
7
8
9

// C a l c u l a t i n g t h e o u t p u t v o l t a g e
clc ;
RAB =125;
Rtotal =5000;
R2 =75/125* Rtotal ;
R4 =2500;
ei =5;
eo =[( R2 / Rtotal ) -( R4 / Rtotal ) ]* ei ;
disp ( eo , o u t p u t v o l t a g e (V)= )

Scilab code Exa 5.7 Calculating the maximum excitation voltage and the
sensitivity
61

1
2
3
4
5
6
7
8
9
10

// C a l c u l a t i n g t h e maximum e x c i t a t i o n v o l t a g e and
the s e n s i t i v i t y
clc ;
Rm =10000;
Rp = Rm /15;
R =600;
P =5;
ei = ( P * R ) ^0.5;
disp ( ei , Maximum e x c i t a t i o n v o l t a g e (V)= )
S = ei /360;
disp (S , S e n s i t i v i t y (V/ d e g r e e )= )

Scilab code Exa 5.8 Calculating the resolution of the potentiometer


1 // C a l c u l a t i n g t h e r e s o l u t i o n
2 clc ;
3 Rwga =1/400;
4 Re = Rwga /5;
5 disp ( Re , R e s o l u t i o n (mm)= )

of the potentiometer

Scilab code Exa 5.9 Checking the suitability of the potentiometer


1
2
3
4
5
6
7
8
9

// C h e c k i n g t h e s u i t a b i l i t y o f t h e p o t e n t i o m e t e r
clc ;
mo =0.8;
sr =250;
sm = sr / mo ;
R = sm *1;
disp (R , r e s o l u t i o n o f 1mm movement )
Rq =300/1000;
disp ( Rq , r e s o l u t i o n r e q u i r e d= )

62

10

disp ( s i n c e t h e r e s o l u t i o n o f p o t e n t i o m e t e r i s
h i g h e r than the r e s o l u t i o n r e q u i r e d so i t i s
s u i t a b l e f o r the a p p l i c a t i o n )

Scilab code Exa 5.10 Checking the suitability of the potentiometer


1 // C h e c k i n g t h e s u i t a b i l i t y o f t h e p o t e n t i o m e t e r
2 clc ;
3 Pd =(10^2) /150;
4 disp ( Pd , Power d i s s i p a t i o n (W)= )
5 th_pot =80+ Pd *30*10^ -3;
6 PDa =1 -(10*10^ -3) *( th_pot -35) ;
7 disp ( PDa , Power d i s s i p a t i o n a l l o w e d (W)= )
8 disp ( S i n c e power d i s s i p a t i o n i s h i g h e r t h a n t h e

d i s s i p a t i o n allowed so p o t e n t i o m e t e r i s not
suitable )

Scilab code Exa 5.11 Calculating the possion ratio


1 // C a l c u l a t i n g t h e p o s s i o n s r a t i o
2 clc ;
3 Gf =4.2;
4 v =( Gf -1) /2;
5 disp (v , P o s s i o n s r a t i o = )

Scilab code Exa 5.12 Calculating the value of the resistance of the gauges
// C a l c u l a t i n g t h e v a l u e o f t h e r e s i s t a n c e o f t h e
gauges
2 clc ;

63

3 strain = -5*10^ -6;


4 Gf = -12.1;
5 R =120;
6 dR_nickel = Gf * R * strain ;
7 disp ( dR_nickel , c h a n g e i n
8
9
10
11

r e s i s t a n c e o f n i c k e l ( ohm )=

)
Gf =2;
R =120;
dR_nicrome = Gf * R * strain ;
disp ( dR_nicrome , c h a n g e i n r e s i s t a n c e o f n i c r o m e ( ohm
)= )

Scilab code Exa 5.13 calculate the percentage change in value of the gauge
resistance
1
2
3
4
5
6
7
8

// c a l c u l a t e t h e p e r c e n t a g e c h a n g e i n v a l u e o f t h e
gauge r e s i s t a n c e
clc ;
s =100*10^6;
E =200*10^9;
strain = s / E ;
Gf =2;
r_perunit = Gf * strain *100;
disp ( r_perunit , P e r c e n t a g e c h a n g e i n r e s i s t a n c e = )

Scilab code Exa 5.14 Calculating the Gauge factor


1
2
3
4
5
6

// C a l c u l a t i n g t h e Gauge f a c t o r
clc ;
b =0.02;
d =0.003;
I =( b * d ^3) /12;
E =200*10^9;
64

7
8
9
10
11
12
13
14
15
16
17
18

x =12.7*10^ -3;
l =0.25;
F =3* E * I * x / l ^3;
x =0.15;
M=F*x;
t =0.003;
s =( M * t ) /( I *2) ;
strain = s / E ;
dR =0.152;
R =120;
Gf =( dR / R ) / strain ;
disp ( Gf , Gauge f a c t o r = )

Scilab code Exa 5.15 Calculating the change in length and the force applied
1
2
3
4
5
6
7
8
9
10
11
12
13
14

// C a l c u l a t i n g t h e c h a n g e i n l e n g t h and t h e f o r c e
applied
clc ;
dR =0.013;
R =240;
l =0.1;
Gf =2.2;
dl =( dR / R ) * l / Gf ;
disp ( dl , c h a n g e i n l e n g t h (m)= )
strain = dl / l ;
E =207*10^9;
s = E * strain ;
A =4*10^ -4;
F=s*A;
disp (F , F o r c e (N) )

Scilab code Exa 5.16 Calculate the linear approximation


65

1
2
3
4
5
6
7
8
9
10
11

// C a l c u l a t e t h e l i n e a r a p p r o x i m a t i o n
clc ;
th1 =30;
th2 =60;
th0 = th1 + th2 /2;
Rth1 =4.8;
Rth2 =6.2;
Rth0 =5.5;
ath0 =(1/ Rth0 ) *( Rth2 - Rth1 ) /( th2 - th1 ) ;
disp ( ath0 , a l p h a a t o d e g r e e ( / d e g r e e C)= )
disp ( 5 . 5 [ 1 + 0 . 0 0 8 5 ( th 45) ] )

Scilab code Exa 5.17 Calculate the linear approximation


1
2
3
4
5
6
7
8
9
10
11

// C a l c u l a t e t h e l i n e a r a p p r o x i m a t i o n
clc ;
th1 =100;
th2 =130;
th0 = th1 + th2 /2;
Rth1 =573.40;
Rth2 =605.52;
Rth0 =589.48;
ath0 =(1/ Rth0 ) *( Rth2 - Rth1 ) /( th2 - th1 ) ;
disp ( ath0 , a l p h a a t o d e g r e e ( / d e g r e e C)= )
disp ( L i n e a r a p p r o x i m a t i o n i s : Rth=
5 8 9 . 4 8 [ 1 + 0 . 0 0 1 8 2 ( th 115) ] )

Scilab code Exa 5.18 Calculate the resistance and the temperature
1 // C a l c u l a t e t h e
2 clc ;
3 Rth0 =100;
4 ath0 =0.00392;

r e s i s t a n c e and t h e t e m p e r a t u r e

66

5 dth =65 -25;


6 R65 = Rth0 *[1+ ath0 * dth ];
7 disp ( R65 , r e s i s t a n c e a t 65 d e g r e e C( ohm )= )
8
9 th ={[(150/100) -1]/ ath0 }+25;
10 disp ( th , T e m p e r a t u r e ( d e g r e e C) )

Scilab code Exa 5.19 Calculate the resistance


1 // C a l c u l a t e t h e r e s i s t a n c e
2 clc ;
3 Rth0 =10;
4 ath0 =0.00393;
5 dth =150 -20;
6 R150 = Rth0 *[1+ ath0 * dth ];
7 disp ( R150 , r e s i s t a n c e a t 150 d e g r e e C( ohm )= )

Scilab code Exa 5.20 Calculate the time


1
2
3
4
5
6
7

// C a l c u l a t e t h e t i m e
clc ;
th =30;
th0 =50;
tc =120;
t = -120*[ log (1 -( th / th0 ) ) ];
disp (t , t i m e ( s )= )

Scilab code Exa 5.21 Calculate the resistance


1

// C a l c u l a t e t h e r e s i s t a n c e
67

2
3
4
5
6
7

clc ;
R25 =100;
ath = -0.05;
dth =35 -25;
R35 = R25 *[1+ ath * dth ];
disp ( R35 , r e s i s t a n c e a t 35 d e g r e e C( ohm )= )

Scilab code Exa 5.22 find resistance


1 //
2 clc ;
3 Ro =3980;
4 Ta =273;
5 disp ( 3980= a 3 9 8 0 exp ( b / 2 7 3 ) )
6 Rt50 =794;
7 Ta50 =273+50;
8 disp ( 794= a 3 9 8 0 exp ( b / 3 2 3 ) )
9 disp ( on s o l v i n g )
10 disp ( a =3010 6 , b=2843 )
11 Ta40 =273+40;
12 Rt40 =(30*10^ -6) *3980* exp (2843/313) ;
13 disp ( Rt40 , R e s i s t a n c e a t 40 d e g r e e C ( ohm ) )
14 Rt100 =(30*10^ -6) *3980* exp (2843/373) ;
15 disp ( Rt100 , R e s i s t a n c e a t 100 d e g r e e C ( ohm ) )

Scilab code Exa 5.23 calculating the change in temperature


1 // c a l c u l a t i n g t h e c h a n g e i n t e m p e r a t u r e
2 clc ;
3 th =((1 -1800/2000) /0.05) +70;
4 dth = th -70;
5 disp ( dth , c h a n g e i n t e m p e r a t u r e ( d e g r e e C) )

68

Scilab code Exa 5.24 calculating the frequencies of oscillation


1
2
3
4
5
6
7
8
9
10
11
12

// c a l c u l a t i n g t h e f r e q u e n c i e s o f
clc ;
C =500*10^ -12;
R20 =10000*(1 -0.05*(20 -25) ) ;
f20 =1/(2* %pi * R20 * C ) ;
disp ( f20 , F r e q u e n c y o f o s c i l l a t i o n
Hz ) )
R25 =10000*(1 -0.05*(25 -25) ) ;
f25 =1/(2* %pi * R25 * C ) ;
disp ( f25 , F r e q u e n c y o f o s c i l l a t i o n
Hz ) )
R30 =10000*(1 -0.05*(30 -25) ) ;
f30 =1/(2* %pi * R30 * C ) ;
disp ( f30 , F r e q u e n c y o f o s c i l l a t i o n
Hz ) )

oscillation

a t 20 d e g r e e C (

a t 25 d e g r e e C (

a t 30 d e g r e e C (

Scilab code Exa 5.25 Calculating the sensitivity and maximum output
voltage
1
2
3
4
5
6

// C a l c u l a t i n g t h e s e n s i t i v i t y and maximum o u t p u t
voltage
clc ;
Se_thermocouple =500 -( -72) ;
disp ( Se_thermocouple , S e n s i t i v i t y o f t h e r m o c o u p l e (
m i c r o V/ d e g r e e C)= )
Vo = Se_thermocouple *100*10^ -6;
disp ( Vo , maximum o u t p u t v o l t a g e (V)= )

69

Scilab code Exa 5.26 Calculating the temperature


1 // C a l c u l a t i n g t h e t e m p e r a t u r e
2 clc ;
3 ET =27.07+0.8;
4 Disp ( ET , R e q u i r e d e .m. f . (mV) )
5 disp ( t e m p e r a t u r e c o r r e s p o n d i n g t o 2 7 . 8 7 mV i s 620

degree C )

Scilab code Exa 5.27 Calcating the series resistance and approximate error
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

// C a l c a t i n g t h e s e r i e s r e s i s t a n c e and a p p r o x i m a t e
error
clc ;
Rm =50;
Re =12;
E =33.3*10^ -3;
i =0.1*10^ -3;
Rs =( E / i ) -Rm - Re ;
disp ( Rs , s e r i e s r e s i s t a n c e ( ohm )= )
Re =13;
i1 = E /( Rs + Re + Rm ) ;
AE =[( i1 - i ) / i ]*800;
disp ( AE , a p p r o x i m a t e e r r o r due t o r i s e i n r e s i s t a n c e
o f 1 ohm i n Re ( d e g r e e C)= )
R_change =50*0.00426*10;
i1 = E /( Rs + Re + Rm + R_change ) ;
AE =[( i1 - i ) / i ]*800;
disp ( AE , a p p r o x i m a t e e r r o r due t o r i s e i n Temp . o f
10 ( d e g r e e C)= )

Scilab code Exa 5.28 Calculate the values of resistance R1 and R2


70

1
2
3
4
5
6
7
8
9
10
11
12
13
14

// C a l c u l a t e t h e v a l u e s o f r e s i s t a n c e R1 and R2
clc ;
E_20 =0.112*10^ -3; // emf a t 20 d e g r e e C
E_900 =8.446*10^ -3;
E_1200 =11.946*10^ -3;
E1 = E_900 - E_20 ;
E2 = E_1200 - E_20 ;
disp ( E1 =1. 08 R1 / ( R1+2.5+R2 ) ;
( i ) )
disp ( E2 = 1 . 0 8 ( R1 + 2 . 5 ) / ( R1+2.5+R2 ) ;
( i i ) )
disp ( on s o l v i n g ( i ) and ( i i ) )
R1 =5.95;
R2 =762.6;
disp ( R1 , v a l u e o f r e s i s t a n c e R1 ( ohm )= )
disp ( R2 , v a l u e o f r e s i s t a n c e R2 ( ohm )= )

Scilab code Exa 5.29 Calculate the percentage linearity


1 // C a l c u l a t e t h e p e r c e n t a g e l i n e a r i t y
2 clc ;
3 linearity_percentage =(0.003/1.5) *100;
4 disp ( linearity_percentage , p e r c e n t a g e l i n e a r i t y = )

Scilab code Exa 5.30 Calculate senstivity of the LVDT


1
2
3
4
5
6
7
8

// C a l c u l a t e s e n s t i v i t y o f t h e LVDT, I n s t r u m e n t and
r e s o l u t i o n o f i n s t r u m e n t i n mm
clc ;
displacement =0.5;
Vo =2*10^ -3;
Se_LVDT = Vo / displacement ;
disp ( Se_LVDT , s e n s t i v i t y o f t h e LVDT (V/mm) )
Af =250;
Se_instrument = Se_LVDT * Af ;
71

9
10
11
12
13

disp ( Se_instrument , s e n s t i v i t y o f i n s t r u m e n t (V/mm)


)
sd =5/100;
Vo_min =50/5;
Re_instrument =1*1/1000;
disp ( Re_instrument , r e s o l u t i o n o f i n s t r u m e n t i n mm )

Scilab code Exa 5.31 calculate the deflection maximum and minimum force
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

// c a l c u l a t e t h e d e f l e c t i o n , maximum and minimum


force
clc ;
b =0.02;
t =0.004;
I =(1/12) * b * t ^3;
F =25;
l =0.25;
E =200*10^9;
x =( F * l ^3) /(3* E * I ) ;
disp (x , d e f l e c t i o n (m) )
DpF = x / F ;
Se = DpF *0.5*1000;
Re =(10/1000) *(2/10) ;
F_min = Re / Se ;
F_max =10/ Se ;
disp ( F_min , minimum f o r c e (N) )
disp ( F_max , maximum f o r c e (N) )
disp ( Se , )

Scilab code Exa 5.32 calculating the sensitivity of the transducer


1 // c a l c u l a t i n g
2 clc ;

the s e n s i t i v i t y of the transducer

72

3
4
5
6
7
8

disp ( p e r m i t t i v i t y o f t h e a i r e 0 =8.8510 12 )
e0 =8.85*10^ -12;
w =25*10^ -3;
d =0.25*10^ -3;
Se = -4* e0 * w / d ;
disp ( Se , s e n s i t i v i t y o f t h e t r a n s d u c e r ( F/m)= )

Scilab code Exa 5.33 Calculate the value of the capacitance afte the application of pressure
1
2
3
4
5
6
7

// C a l c u l a t e t h e v a l u e o f t h e c a p a c i t a n c e a f t e t h e
application of pressure
clc ;
C1 =370*10^ -12;
d1 =3.5*10^ -3;
d2 =2.9*10^ -3;
C2 = C1 * d1 / d2 ;
disp ( C2 , t h e v a l u e o f t h e c a p a c i t a n c e a f t e t h e
a p p l i c a t i o n o f p r e s s u r e ( F )= )

Scilab code Exa 5.34 Calculate the change in frequency of the oscillator
1
2
3
4
5
6
7
8

// C a l c u l a t e t h e c h a n g e i n f r e q u e n c y o f t h e
oscillator
clc ;
fo1 =100*10^3;
d1 =4;
d2 =3.7;
fo2 =[( d2 / d1 ) ^0.5]* fo1 ;
dfo = fo1 - fo2 ;
disp ( dfo , c h a n g e i n f r e q u e n c y o f t h e o s c i l l a t o r ( Hz )
)
73

Scilab code Exa 5.35 Calculate the dielectric stress change in value of capacitance
1
2
3
4
5
6
7
8
9
10
11
12
13
14

// C a l c u l a t e t h e d i e l e c t r i c s t r e s s , c h a n g e i n v a l u e
of capacitance
clc ;
L_air =(3.1 -3) /2;
D_stress =100/ L_air ;
e0 =8.85*10^ -12;
l =20*10^ -3;
D2 =3.1;
D1 =3;
C =(2* %pi ) * e0 * l /( log ( D2 / D1 ) ) ;
disp (C , C a p a c i t a n c e ( F )= )
l =(20*10^ -3) -(2*10^ -3) ;
C_new =(2* %pi ) * e0 * l /( log ( D2 / D1 ) ) ;
C_change =C - C_new ;
disp ( C_change , c h a n g e i n C a p a c i t a n c e ( F )= )

Scilab code Exa 5.36 Calculate the value of time constant phase shift series resistance amplitude ratio and voltage sensitivity
1

2
3
4
5
6
7
8

// C a l c u l a t e t h e v a l u e o f t i m e c o n s t a n t , p h a s e s h i f t ,
s e r i e s r e s i s t a n c e , a m p l i t u d e r a t i o and v o l t a g e
sensitivity
clc ;
M =0.95;
w =2* %pi *20;
tc =(1/ w ) *[( M ^2) /(1 - M ^2) ]^0.5;
disp ( tc , t i m e c o n s t a n t ( s ) )
ph ={( %pi /2) -[ atan ( w * tc ) ]}*(180/ %pi ) ;
disp ( ph , p h a s e s h i f t ( deg ) )
74

9
10
11
12
13
14
15
16
17

C =(8.85*10^ -12*300*10^ -6) /(0.125*10^ -3) ;


R = tc / C ;
disp (R , s e r i e s r e s i s t a n c e ( ohm ) )
M =1/(1+(1/(2* %pi *5* tc ) ^2) ) ^0.5;
disp (M , a m p l i t u d e r a t i o = )
Eb =100;
x =0.125*10^ -3;
Vs = Eb / x ;
disp ( Vs , v o l t a g e s e n s i t i v i t y (V/m) )

Scilab code Exa 5.37 Calculate the change in capacitance and ratio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

// C a l c u l a t e t h e c h a n g e i n c a p a c i t a n c e and r a t i o
clc ;
e0 =8.85*10^ -12;
A =500*10^ -6;
d =0.2*10^ -3;
C = e0 * A / d ;
d1 =0.18*10^ -3;
C_new = e0 * A / d1 ;
C_change = C_new - C ;
Ratio =( C_change / C ) /(0.02/0.2) ;
disp ( Ratio , r a t i o o f p e r u n i t c h a n g e o f c a p a c i t a n c e
to per u n i t change o f diaplacement )
d1 =0.19*10^ -3;
e1 =1;
d2 =0.01*10^ -3;
e2 =8;
C =( e0 * A ) /(( d1 / e1 ) +( d2 / e2 ) ) ;
d1_new =0.17*10^ -3;
C_new =( e0 * A ) /(( d1_new / e1 ) +( d2 / e2 ) ) ;
C_change = C_new - C ;
Ratio =( C_change / C ) /(0.02/0.2) ;
disp ( Ratio , r a t i o o f p e r u n i t c h a n g e o f c a p a c i t a n c e
to per u n i t change o f diaplacement )
75

Scilab code Exa 5.40 Calculate the output voltage and charge sensitivity
1
2
3
4
5
6
7
8
9
10

// C a l c u l a t e t h e o u t p u t v o l t a g e and c h a r g e
sensitivity
clc ;
g =0.055;
t =2*10^ -3;
P =1.5*10^6;
Eo = g * t * P ;
disp ( Eo , o u t p u t v o l t a g e (V)= )
e =40.6*10^ -12;
d=e*g;
disp (d , c h a r g e s e n s i t i v i t y (C/N)= )

Scilab code Exa 5.41 Calculate the force


1
2
3
4
5
6
7
8
9

// C a l c u l a t e t h e f o r c e
clc ;
g =0.055;
t =1.5*10^ -3;
Eo =100;
P = Eo /( g * t ) ;
A =25*10^ -6;
F=P*A;
disp (F , F o r c e (N)= )

Scilab code Exa 5.42 Calculate the strain charge and capacitance clc
1

// C a l c u l a t e t h e s t r a i n , c h a r g e and c a p a c i t a n c e
76

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

clc ;
A =25*10^ -6;
F =5;
P=F/A;
d =150*10^ -12;
e =12.5*10^ -9;
g = d /( e ) ;
t =1.25*10^ -3;
Eo =( g * t * P ) ;
strain = P /(12*10^6) ;
Q=d*F;
C = Q / Eo ;
disp ( strain , s t r a i n = )
disp (Q , c h a r g e (C)= )
disp (C , C a p a c i t a n c e ( F )= )

Scilab code Exa 5.43 calculate peak to peak voltage swing under open
and loaded conditions calculate maximum change in crystal thickness
1
2
3
4
5
6
7
8
9
10
11
12
13
14

// c a l c u l a t e peak t o peak v o l t a g e s w i n g u n d e r open


and l o a d e d c o n d i t i o n s
// c a l c u l a t e maximum c h a n g e i n c r y s t a l t h i c k n e s s
clc ;
d =2*10^ -12;
t =1*10^ -3;
Fmax =0.01;
e0 =8.85*10^ -12;
er =5;
A =100*10^ -6;
Eo_peak_to_peak =2* d * t * Fmax /( e0 * er * A ) ;
disp ( Eo_peak_to_peak , peak v o l t a g e s w i n g u n d e r open
conditions )
Rl =100*10^6;
Cl =20*10^ -12;
d1 =1*10^ -3;
77

15
16
17
18
19
20
21

Cp = e0 * er * A / d1 ;
C = Cp + Cl ;
w =1000;
m =[ w * Cp * Rl /[1+( w * C * Rl ) ^2]^0.5];
El_peak_to_peak =[2* d * t * Fmax /( e0 * er * A ) ]* m ;

disp ( El_peak_to_peak , peak v o l t a g e s w i n g u n d e r


loaded conditions )
22 E =90*10^9;
23 dt =2* Fmax * t /( A * E ) ;
24 disp ( dt , maximum c h a n g e i n c r y s t a l t h i c k n e s s (m) )

Scilab code Exa 5.44 Calculate the minimum frequency and phase shift
1
2
3
4
5
6
7
8

// C a l c u l a t e t h e minimum f r e q u e n c y and p h a s e s h i f t
clc ;
M =0.95;
tc =1.5*10^ -3;
w =(1/ tc ) *[( M ^2) /(1 - M ^2) ]^0.5;
disp (w , minimum f r e q u e n c y ( r a d / s ) )
ph ={( %pi /2) -[ atan ( w * tc ) ]}*(180/ %pi ) ;
disp ( ph , p h a s e s h i f t ( deg ) )

Scilab code Exa 5.45 calculate sensitivity of the transducer high frequency
sensitivity Lowest frequency Calculate external shunt capacitance and high
frequency sensitivity after connecting the external shunt capacitance
// c a l c u l a t e s e n s i t i v i t y o f t h e t r a n s d u c e r , h i g h
f r e q u e n c y s e n s i t i v i t y , Lowest f r e q u e n c y
2 // C a l c u l a t e e x t e r n a l s h u n t c a p a c i t a n c e and h i g h
frequency s e n s i t i v i t y a f t e r connecting the
e x t e r n a l shunt c a p a c i t a n c e
3 clc ;
1

78

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

Kq =40*10^ -3;
Cp =1000*10^ -12;
K = Kq / Cp ;
disp (K , s e n s i t i v i t y o f t h e t r a n s d u c e r (V/m) )
Cc =300*10^ -12;
Ca =50*10^ -12;
C = Cp + Cc + Ca ;
Hf = Kq / C ;
disp ( Hf , h i g h f r e q u e n c y s e n s i t i v i t y (V/m) )
R =1*10^6;
tc = R * C ;
M =0.95;
w =(1/ tc ) *[( M ^2) /(1 - M ^2) ]^0.5;
f = w /(2* %pi ) ;
disp (w , minimum f r e q u e n c y ( s ) )
disp ( now f =10Hz )
f =10;
w =2* %pi * f ;
tc =(1/ w ) *[( M ^2) /(1 - M ^2) ]^0.5;
C_new = tc / R ;
Ce = C_new - C ;
disp ( Ce , e x t e r n a l s h u n t c a p a c i t a n c e ( F ) )
Hf_new = Kq / C_new ;
disp ( Hf_new , new v a l u e o f h i g h f r e q u e n c y s e n s i t i v i t y
(V/m) )

Scilab code Exa 5.46 calculate op volatge


1
2
3
4
5
6
7

//
clc ;
R =10^6;
C =2500*10^ -12;
tc = R * C ;
t =2*10^ -3;
d =100*10^ -12;
79

8
9
10
11
12
13
14
15
16
17

F =0.1;
el =10^3*{ d * F *[ exp ( - t / tc ) ]/ C };
disp ( el , v o l t a g e j u s t b e f o r e t =2ms (mV) )
el_after =10^3*{ d * F *[ exp ( - t / tc ) -1]/ C };
disp ( el_after , v o l t a g e j u s t a f t e r t =2ms (mV) )
disp ( when t =10ms )
t =10*10^ -3;
T =2*10
e_10 =10^3*{ d * F *[ exp (( - T / tc ) -1) ]*{ exp ( -(t - T ) ) / tc }/ C }
disp ( e_10 , o u t p u t v o l t a g e 10 ms a f t e r t h e
a p p l i c a t i o n o f i m p u l s e (mV) )

Scilab code Exa 5.47 to prove time constant should be approximately 20T
1
2
3
4
5
6
7
8

// t o p r o v e t i m e c o n s t a n t s h o u l d be a p p r o x i m a t e l y 20
T t o k e e p u n d e r s h o o t w i t h i n 5%
clc ;
disp ( L e t T=1 ) ;
T =1;
el =0.95;
tc = - T / log ( el ) ;
disp ( tc , t i m e c o n s t a n t )
disp ( a s T=1 s o t i m e c o n s t a n t s h o u l d be
a p p r o x i m a t e l y e q u a l t o 20T )

Scilab code Exa 5.48 calculate op volatge


1
2
3
4
5
6

//
clc ;
Kh = -1*10^ -6;
I =3;
B =0.5;
t =2*10^ -3;
80

7 Eh = Kh * I * B / t ;
8 disp ( Eh , o u t p u t v o l t a g e (V) )

Scilab code Exa 5.49 Calculate the threshold wavelength


1 // C a l c u l a t e t h e t h r e s h o l d w a v e l e n g t h
2 clc ;
3 Th_wavelength =1.24*10^ -6/1.8
4 disp ( Th_wavelength , T h r e s h o l d w a v e l e n g t h (m) )

Scilab code Exa 5.50 Calculate maximum velocity of emitted photo electrons
1
2
3
4
5
6
7

// C a l c u l a t e maximum v e l o c i t y o f e m i t t e d p h o t o
electrons
clc ;
E_imparted =(1.24*10^ -6) /(0.2537*10^ -6) ;
B_energy = E_imparted -4.30;
em_ratio =0.176*10^12;
v =(2* B_energy * em_ratio ) ^0.5;
disp (v , maximum v e l o c i t y o f e m i t t e d p h o t o e l e c t r o n s
(m/ s ) )

Scilab code Exa 5.51 Calculate the resistance of the cell


1
2
3
4
5

// C a l c u l a t e t h e r e s i s t a n c e o f t h e c e l l
clc ;
Ri =30;
Rf =100;
t =10;
81

6 tc =72;
7 Rt = Ri +( Rf - Ri ) *[1 - exp ( - t / tc ) ];
8 disp ( Rt , r e s i s t a n c e o f t h e c e l l

(K ohm ) )

Scilab code Exa 5.52 Calculate incident power and cut off frequency
1
2
3
4
5
6
7
8

// C a l c u l a t e i n c i d e n t power and c u t o f f f r e q u e n c y
clc ;
I_power =250*0.2*10^ -6;
disp ( I_power , i n c i d e n t power (W) )
Rl =10*10^3;
C =2*10^ -12;
fc =1/(2* %pi * Rl * C ) ;
disp ( fc , c u t o f f f r e q u e n c y ( Hz ) )

Scilab code Exa 5.53 Calculate the internal resistance of cell and open
circuit voltage
1
2
3
4
5
6
7
8
9

// C a l c u l a t e t h e i n t e r n a l r e s i s t a n c e o f c e l l and
open c i r c u i t v o l t a g e
clc ;
I =2.2*10^ -3;
Eo =0.33;
Rl =100;
Ri =( Eo / I ) -100;
disp ( Ri , i n t e r n a l r e s i s t a n c e o f c e l l ( ohm ) )
Vo =0.33*[ log (25) / log (10) ];
disp ( Vo , open c i r c u i t v o l t a g e f o r a r a d i a n t
i n c i d e n c e o f 25 W/m2 (V)= )

82

Scilab code Exa 5.54 Find the value of current


1
2
3
4
5
6
7
8
9

// Find t h e v a l u e o f c u r r e n t
clc ;
A =1935*10^ -6;
r =0.914;
S_angle = A / r ^2;
I =180;
L_flux = I * S_angle ;
disp ( L_flux , l u m n i o u s f l u x= )
disp ( C o r r e s p o n d i n g t o l u m n i o u s f l u x o . 4 1 7 lm and a
l o a d r e s i s t a n c e o f 800 ohm t h e c u r r e n t i s 120
m i c r o Ampere )

83

Chapter 6
Signal Conditioning

Scilab code Exa 6.1 calculating feedback resistance


1
2
3
4
5
6

// c a l c u l a t i n g f e e d b a c k r e s i s t a n c e
clc ;
A =100;
R1 =1*10^3;
Rf = - A * R1 ;
disp ( Rf , f e e d b a c k r e s i s t a n c e ( ohm )= ) ;

Scilab code Exa 6.2 calculating the closed loop gain


1
2
3
4
5
6
7

// c a l c u l a t i n g t h e c l o s e d l o o p g a i n
clc ;
Rf =10;
R1 =1;
Avol =200000;
A = -( Rf / R1 ) *(1/[1+(1/ Avol ) *(( R1 + Rf ) / R1 ) ]) ;
disp (A , c l o s e d l o o p g a i n= )

84

Scilab code Exa 6.3 calculating the maximum output voltage


1 // c a l c u l a t i n g t h e maximum o u t p u t v o l t a g e
2 clc ;
3 Sa =10;
4 disp ( Sa , s a t u r a t i o n v o l t a g e= )
5 Vom = Sa ;
6 disp ( Vom , maximum o u t p u t v o l t a g e )

Scilab code Exa 6.4 calculating output voltage due to offset voltage
1
2
3
4
5
6
7

// c a l c u l a t i n g o u t p u t v o l t a g e due t o o f f s e t v o l t a g e
clc ;
Vos =5*10^ -3;
Rf =10;
R1 =1;
Vo = - Vos *(1+ Rf / R1 ) ;
disp ( Vo , o u t p u t v o l t a g e due t o o f f s e t v o l t a g e (V)= )

Scilab code Exa 6.5 calculating Amplification factor


1
2
3
4
5
6
7

// c a l c u l a t i n g A m p l i f i c a t i o n f a c t o r
clc ;
Rf =10;
R1 =1;
A = Rf / R1 ;
disp (A , A m p l i f i c a t i o n F a c t o r= )

Scilab code Exa 6.6 calculating output voltage due to offset voltage
85

1
2
3
4
5
6
7
8
9

// c a l c u l a t i n g o u t p u t v o l t a g e due t o o f f s e t v o l t a g e
clc ;
V1 =1;
V2 = -2;
Rf =500;
R1 =250;
R2 =100;
Vo = -{[( Rf / R1 ) * V1 ]+[( Rf / R2 ) * V2 ]};
disp ( Vo , o u t p u t v o l t a g e (V)= )

Scilab code Exa 6.7 calculating gain and feedback resistance


1
2
3
4
5
6
7
8
9
10
11

// c a l c u l a t i n g g a i n and f e e d b a c k r e s i s t a n c e
clc ;
Rf =100*10^3;
R1 =1*10^3;
A = Rf / R1 ;
disp (A , Gain= )
disp ( I f m u l t i p l i e r i s 10 )
A =10;
Rf = A * R1 ;
disp ( Rf , f e e d b a c k r e s i s t a n c e (Ohm)= )

Scilab code Exa 6.8 Calculating the values of resistances


1
2
3
4
5
6
7

// C a l c u l a t i n g t h e v a l u e s o f r e s i s t a n c e s
clc ;
g =10;
Rf =10;
R1 = Rf / g ;
disp ( R1 , r e s i s t a n c e R1 ( K i l o ohms )= )
R2 = Rf /(0.5* g ) ;
86

8 disp ( R2 , r e s i s t a n c e R1 ( K i l o ohms )= )
9 R3 = Rf /(0.333* g ) ;
10 disp ( R3 , r e s i s t a n c e R1 ( K i l o ohms )= )

Scilab code Exa 6.9 Calculating the value of resistance and capacitance
1
2
3
4
5
6
7

// C a l c u l a t i n g t h e v a l u e o f r e s i s t a n c e and
capacitance
clc ;
Voramp = -10;
disp ( i f v o l t a g e s o u r c e i s 10V t h e n RC= 1 ms and i f
C=1 micro F )
C =1;
R =1*10^ -3*10^6;
disp (R , v a l u e o f r e s i s t a n c e ( ohm )= )

Scilab code Exa 6.10 Calculating Difference mode gain and output voltage
1
2
3
4
5
6
7
8
9
10
11
12

// C a l c u l a t i n g D i f f e r e n c e mode g a i n and o u t p u t
voltage
clc ;
V2 =5*10^ -3;
V1 =3*10^ -3;
Vo =300*10^ -3;
Vd = V2 - V1 ;
Ad = Vo / Vd ;
disp ( Ad , d i f f e r e n c e mode g a i n= )
V2 =155*10^ -3;
V1 =153*10^ -3;
Vo = Ad *( V2 - V1 ) ;
disp ( Vo , o u t p u t v o l t a g e (V)= )
87

Scilab code Exa 6.11 Calculating Difference mode Common mode gain
and CMRR
1
2
3
4
5
6
7
8
9
10
11
12

// C a l c u l a t i n g D i f f e r e n c e mode , Common mode g a i n and


CMRR
clc ;
Vo =3;
Vd =30*10^ -3;
Ad = Vo / Vd ;
disp ( Ad , d i f f e r e n c e mode g a i n= )
Vo =5*10^ -3;
Vc =500*10^ -3;
Ac = Vo / Vc ;
disp ( Ac , Common mode g a i n= )
CMRR = Ad / Ac ;
disp ( CMRR , Common mode r e j e c t i o n r a t i o = )

Scilab code Exa 6.12 Calculating Signal to noise ratio and CMRR
1
2
3
4
5
6
7
8
9
10
11
12
13

// C a l c u l a t i n g S i g n a l t o n o i s e r a t i o and CMRR
clc ;
V2 =30*10^ -3;
V1 = -30*10^ -3;
Vd = V2 - V1 ;
Ad =150;
Vos = Ad * Vd ;
Ac =0.04;
Vc =600*10^ -3;
Von = Ac * Vc ;
SNR = Vos / Von ;
CMRR = Ad / Ac ;
disp ( SNR , S i g n a l t o N o i s e R a t i o= )
88

14
15

disp ( CMRR , CMRR= )

Scilab code Exa 6.13 Calculating sensitivity and output voltage


1
2
3
4
5
6
7
8
9
10
11

// C a l c u l a t i n g s e n s i t i v i t y and o u t p u t v o l t a g e
clc ;
Ci =10*10^ -12;
Vi =10;
Eo =8.85*10^ -12;
A =200*10^ -6;
K = - Ci * Vi /( Eo * A ) ;
disp (K , s e n s i t i v i t y (V/mm)= )
d =1*10^ -6;
Vo = K * d ;
disp ( Vo , o u t p u t v o l t a g e (V)= )

Scilab code Exa 6.14 calculating minimum maximum time constants and
value of frequencies
1
2
3
4
5
6
7
8
9
10
11

// c a l c u l a t i n g minimum , maximum t i m e c o n s t a n t s and


value of frequencies
clc ;
MXtc = 10^10*1000*10^ -12;
disp ( MXtc , Maximum t i m e c o n s t a n t ( s ) ) ;
MNtc = 10^8*10*10^ -12;
disp ( MNtc , Minimum t i m e c o n s t a n t ( s ) ) ;
AR =0.95;
fmin =( AR ) /[2* %pi * MXtc *(1 - AR ^2) ^0.5];
disp ( fmin , minimum f r e q u e n c y ( Hz ) )
fmax =( AR ) /[2* %pi * MNtc *(1 - AR ^2) ^0.5];
disp ( fmax , Maximum f r e q u e n c y ( Hz ) )
89

Scilab code Exa 6.15 calculating time constant and value of capacitance
1
2
3
4
5
6
7
8
9
10

// c a l c u l a t i n g
t i m e c o n s t a n t and v a l u e o f
capacitance
clc ;
g =0.501;
f =50;
w =2* %pi * f ;
tc =(1 - g ^2) ^0.5/( w * g ) ;
disp ( tc , t i m e c o n s t a n t ( s ) )
R =10000;
C =( tc / R ) *10^6;
disp (C , c a p a c i t a n c e ( micro F ) )

Scilab code Exa 6.16 calcuating the passband gain and upper and lower
cut off frequencies
1
2
3
4
5
6
7
8
9
10
11
12

// c a l c u a t i n g t h e p a s s b a n d g a i n and u p p e r & l o w e r
cut o f f f r e q u e n c i e s
clc ;
R1 =10*10^3;
R2 =1*10^6;
A = R2 /( R1 + R2 ) ;
disp (A , g a i n= )
C2 =(0.01) *10^ -6;
C1 =100*10^ -12;
fcl =1/(2* %pi * C2 * R2 ) ;
disp ( fcl , l o w e r c u t o f f f r e q u e n c y ( Hz ) )
fcu =1/(2* %pi * R1 * C1 ) ;
disp ( fcu , u p p e r c u t o f f f r e q u e n c y ( Hz ) )

90

Scilab code Exa 6.17 calcuating the value of C


1
2
3
4
5
6

// c a l c u a t i n g t h e v a l u e o f C
clc ;
R =1*10^6;
fo =10*10^3;
C =1/(2* %pi * fo * R ) ;
disp (C , t h e v a l u e o f C ( F ) )

Scilab code Exa 6.19 calculate the output voltage and sensitivity
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

// c a l c u l a t e t h e o u t p u t v o l t a g e and s e n s i t i v i t y
clc ;
Rt =100;
K =1;
Rb = K * Rt ;
ei =10;
disp ( When K=1 )
eo =[( K * Rt / Rb ) /(1+( K * Rt / Rb ) ) ]* ei ;
disp ( eo , o u t p u t v o l t a g e (V)= )
Se =( ei * Rb ) /[( Rb + K * Rt ) ^2];
disp ( Se , s e n s i t i v i t y (V/ohm )= )
K =0.95;
disp ( When K=0.95 )
eo =[( K * Rt / Rb ) /(1+( K * Rt / Rb ) ) ]* ei ;
disp ( eo , o u t p u t v o l t a g e (V)= )
Se =( ei * Rb ) /[( Rb + K * Rt ) ^2];
disp ( Se , s e n s i t i v i t y (V/ohm )= )

91

Scilab code Exa 6.20 calculate the output voltage for different values of
K
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

// c a l c u l a t e t h e o u t p u t v o l t a g e f o r d i f f e r e n t v a l u e s
of K
clc ;
ei =100;
K =0.25;
disp ( When K=0.25 )
eo =[( K /6) /(1+( K /6) ) ]* ei ;
disp ( eo , o u t p u t v o l t a g e (V)= )
K =0.5;
disp ( When K=0.5 )
eo =[( K /6) /(1+( K /6) ) ]* ei ;
disp ( eo , o u t p u t v o l t a g e (V)= )
K =0.6;
disp ( When K=0.6 )
eo =[( K /6) /(1+( K /6) ) ]* ei ;
disp ( eo , o u t p u t v o l t a g e (V)= )
K =0.8;
disp ( When K=0.8 )
eo =[( K /6) /(1+( K /6) ) ]* ei ;
disp ( eo , o u t p u t v o l t a g e (V)= )

Scilab code Exa 6.21 calculating the resistance and output voltage
1
2
3
4
5
6
7
8
9

// c a l c u l a t i n g t h e r e s i s t a n c e and o u t p u t v o l t a g e
clc ;
R2 =119;
R3 =119.7;
R1 =120.4;
R4 = R2 * R3 / R1 ;
R4 =121.2;
ei =12;
eo =[( R1 * R4 - R2 * R3 ) /(( R1 + R3 ) *( R2 + R4 ) ) ]* ei ;
92

10

disp ( eo , o u t p u t v o l t a g e (V)= )

Scilab code Exa 6.22 Calculating the bridge output


1
2
3
4
5
6
7
8
9
10
11
12

// C a l c u l a t i n g t h e b r i d g e o u t p u t
clc ;
ei =6;
R =10000;
disp ( i f dR=0.05R )
dR =0.05* R ;
eo =[( dR / R ) /(4+2*( dR / R ) ) ]* ei ;
disp ( eo , o u t p u t v o l t a g e (V) )
disp ( i f dR= 0.05R )
dR = -0.05* R ;
eo =[( dR / R ) /(4+2*( dR / R ) ) ]* ei ;
disp ( eo , o u t p u t v o l t a g e (V) )

Scilab code Exa 6.23 Calculating the resistance of unknown resistance


1
2
3
4
5
6
7
8
9
10
11
12

// C a l c u l a t i n g t h e r e s i s t a n c e o f unknown r e s i s t a n c e
clc ;
R2 =800;
R3 =800;
R4 =800;
Rm =100;
R =800;
ei =4;
im =0.8*10^ -6;
dR =( im * R ^2) *(4*(1+ Rm / R ) ) / ei ;
R1 = R + dR ;
disp ( R1 , R e s i s t a n c e o f unknown r e s i s t o r ( ohm )= )

93

Scilab code Exa 6.24 calculating the current


1
2
3
4
5
6
7
8
9
10
11
12
13

// c a l c u l a t i n g t h e c u r r e n t
clc ;
R2 =1000;
R3 =1000;
R1 =1010;
R4 =1000;
ei =100;
eo =[( R1 * R4 - R2 * R3 ) /(( R1 + R3 ) *( R2 + R4 ) ) ]* ei ;
disp ( eo , open c i r c u i t v o l t a g e (V)= )
Ro =[ R1 * R4 /( R1 + R4 ) ]+[ R2 * R3 /( R2 + R3 ) ];
Rm =4000;
im = eo /( Ro + Rm ) ;
disp ( im , c u r r e n t (A)= )

Scilab code Exa 6.25 Calculating maximum permissible current through


strain gauge supply voltage and Power dissipation in series resistance
1
2
3
4
5
6
7
8
9
10
11

// C a l c u l a t i n g maximum p e r m i s s i b l e c u r r e n t t h r o u g h
s t r a i n gauge , s u p p l y v o l t a g e
// and Power d i s s i p a t i o n i n s e r i e s r e s i s t a n c e
clc ;
R =100;
P =250*10^ -3;
i =( P / R ) ^0.5;
disp (i , maximum p e r m i s s i b l e c u r r e n t (A)= )
ei =2* i * R ;
disp ( ei , maximum s u p p l y v o l t a g e (V)= )
Rs =100;
Ps =10^2/ Rs ;

94

12

disp ( Ps , Power d i s s i p a t i o n i n s e r i e s
)

r e s i s t a n c e (W)

Scilab code Exa 6.26 Calculating the maximum voltage sensitivity of the
bridge
1
2
3
4
5
6
7
8
9
10

// C a l c u l a t i n g
t h e maximum v o l t a g e s e n s i t i v i t y o f
the bridge
clc ;
P =(0.1/0.2) *10^ -3;
R =1000;
eim =2*( P * R ) ^0.5;
dth =0.1;
dR =(4.5/100) * dth * R ;
eom =( dR /(4* R ) ) * eim ;
Sem = eom / dth ;
disp ( Sem , maximum v o l t a g e s e n s i t i v i t y o f t h e b r i d g e
(V)= )

Scilab code Exa 6.27 Calculating the resolution of the instrument quantization error and decesion levels
1
2
3
4
5
6
7
8
9
10

// C a l c u l a t i n g t h e r e s o l u t i o n o f t h e i n s t r u m e n t ,
q u a n t i z a t i o n e r r o r and d e c e s i o n l e v e l s
clc ;
Reso =10*10^ -3/10;
disp ( Reso , r e s o l u t i o n o f t h e i n s t r u m e n t= )
n =10;
Q =10/2^ n ;
Eq = Q /(2*3^0.5) ;
disp ( Eq , q u a n t i z a t i o n e r r o r= )
D =(2^ n ) -1;
disp (D , d e c e s i o n l e v e l s = )
95

Scilab code Exa 6.28 Calculating the weight of MSB and LSB
1 // C a l c u l a t i n g t h e w e i g h t o f MSB and LSB
2 clc ;
3 Ra =10;
4 b =5;
5 Wmsb = Ra /2;
6 disp ( Wmsb , w e i g h t o f MSB (V)= )
7 Wlsb = Ra /2^ b ;
8 disp ( Wlsb , w e i g h t o f LSB (V)= )

Scilab code Exa 6.29 Calculating reference voltage and percentage change
1
2
3
4
5
6
7
8
9

// C a l c u l a t i n g r e f e r e n c e v o l t a g e and p e r c e n t a g e
change
clc ;
E =10;
ER = E *256/255;
disp ( ER , R e f e r e n c e v o l t a g e (V)= )
n =8;
CVlsb =(2^ - n ) * ER ;
PC = CVlsb *100/ E ;
disp ( PC , P e r c e n t a g e c h a n g e = )

Scilab code Exa 6.30 Calculating the number of bits Value of LSB Quantization error minimum sampling rate Aperature time and dynamic range

96

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

// C a l c u l a t i n g t h e number o f b i t s , V a l u e o f LSB ,
Q u a n t i z a t i o n e r r o r , minimum s a m p l i n g r a t e
A p e r a t u r e t i m e and dynamic r a n g e
clc ;
n =14;
disp (n , number o f b i t s = )
E =10;
Q =10;
LSB = E /2^ n ;
disp ( LSB , V a l u e o f LSB (V) = )
Eq = Q /(2*(3^0.5) ) ;
disp ( Eq , Q u a n t i z a t i o n e r r o r (V) = )
fh =1000;
fs =5* fh ;
disp ( fs , minimum s a m p l i n g r a t e ( Hz ) = )
a =1/16384;
ta =1/(2* %pi * fh ) * a ;
disp ( ta , A p e r a t u r e t i m e ( s ) = )
Dr =6* n ;
disp ( Dr , dynamic r a n g e ( db ) = )

Scilab code Exa 6.31 Calculating the value of resistance and smallest output current
1
2
3
4
5
6
7
8
9

// C a l c u l a t i n g t h e v a l u e o f r e s i s t a n c e and s m a l l e s t
output cu r r en t
clc ;
ER =10;
n =6;
Imax =10*10^ -3;
R = ER *((2^ n ) -1) /[(2^( n -2) ) * Imax ];
disp (R , r e s i s t a n c e ( ohm )= )
LSB = ER /[(2^( n -1) ) * R ];
disp ( LSB , s m a l l e s t o u t p u t c u r r e n t (A) )

97

Scilab code Exa 6.32 Calculating the output voltage


// C a l c u l a t i n g t h e o u t p u t v o l t a g e
clc ;
n =6;
R =10000;
Io = (10/10*10^3)
*{1*1+1*0.5+1*0.25+0*0.125+1*0.0625}*10^ -6;
6 Rf =5000;
7 Eo = - Io * Rf ;
8 disp ( Eo , Output v o l t a g e (V)= )
1
2
3
4
5

Scilab code Exa 6.33 Calculate the output of successive approximation A


to D
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

// C a l c u l a t e t h e o u t p u t o f s u c c e s s i v e a p p r o x i m a t i o n
A/D
clc ;
disp ( S e t d3=1 )
Output =5/2^1;
disp ( s i n c e 3 . 2 1 7 > 2 . 5 s o d3=1 )
disp ( S e t d2=1 )
Output =(5/2^1) +(5/2^2) ;
disp ( s i n c e 3.217 < 3 . 7 5 s o d2=0 )
disp ( S e t d1=1 )
Output =(5/2^1) +(5/2^3) ;
disp ( s i n c e 3 . 2 1 7 > 3 . 1 2 5 s o d1=1 )
disp ( S e t d0=1 )
Output =(5/2^1) +(5/2^3) +(5/2^4) ;
disp ( s i n c e 3 . 2 1 7 < 3 . 4 3 7 5 s o d0=0 )
disp ( Output o f s u c c e s s i v e a p p r o x i m a t i o n A/D = 1 0 1 0
)
98

Scilab code Exa 6.34 to calculate op dc voltage


1
2
3
4
5
6
7
8
9
10
11

// t o c a l c u l a t e o / p dc v o l t a g e
clc ;
t =400;
T = t /4;
C =1*10^ -6;
v =20;
i = C *100* v /( T ) ;
R =1*10^3;
e_o = i * R ;
disp ( e_o , o u t p u t v o l t a g e (V) ) ;

99

Chapter 7
Display Devices and recorders

Scilab code Exa 7.1 calculating resolution


// c a l c u l a t i n g r e s o l u t i o n
clc ;
N = 4;
R =1/10^ N ;
disp (R , R e s o l u t i o n o f t h e m e t e r= ) ;
VR =1;
R1 = VR * R ;
disp ( R1 , R e s o l u t i o n o f t h e m e t e r f o r v o l t a g e r a n g e 1
V= ) ;
9 VR1 =10;
10 R2 = VR1 * R ;
11 disp ( R2 , R e s o l u t i o n o f t h e m e t e r f o r v o l t a g e r a n g e
10V= ) ;
1
2
3
4
5
6
7
8

Scilab code Exa 7.2 calculating resolution


1 // c a l c u l a t i n g
2 clc ;

resolution

100

3 N = 3;
4 R =1/10^ N ;
5 disp (R , R e s o l u t i o n o f t h e m e t e r= ) ;
6 disp ( 1 2 . 9 8 w i l l be d i s p l a y e d a s 1 2 . 9 8 0 on 10V s c a l e
7
8
9
10
11
12
13
14

)
VR =1;
R1 = VR * R ;
disp ( R1 , R e s o l u t i o n o f t h e m e t e r f o r v o l t a g e r a n g e 1
V= ) ;
disp ( 0 . 6 9 7 3 w i l l be d i s p l a y e d a s 0 . 6 9 7 3 on 1V s c a l e
)
VR1 =10;
R2 = VR1 * R ;
disp ( R2 , R e s o l u t i o n o f t h e m e t e r f o r v o l t a g e r a n g e
10V= ) ;
disp ( 0 . 6 9 7 3 w i l l be d i s p l a y e d a s 0 0 . 6 9 7 on 10V
scale )

Scilab code Exa 7.3 calculating Total possible error and percentage error
1
2
3
4
5
6
7
8
9
10
11
12
13

// c a l c u l a t i n g T o t a l p o s s i b l e e r r o r and p e r c e n t a g e
error
clc ;
R =5;
V =0.005* R ;
disp (V , 0 . 5 p e r c e n t o f t h e r e a d i n g )
TPE = V +0.01;
disp ( TPE , T o t a l p o s s i b l e e r r o r (V)= )
R1 =0.10;
V1 =0.005* R1 ;
TPE1 = V1 +0.01;
disp ( TPE1 , T o t a l p o s s i b l e e r r o r (V)= )
PE =( TPE1 /0.1) *100;
disp ( PE , P e r c e n t a g e e r r o r= )

101

Scilab code Exa 7.4 calculating frequency


1
2
3
4
5
6

// c a l c u l a t i n g f r e q u e n c y
clc ;
N =034;
t =10*10^ -3;
f=N/t;
disp (f , f r e q u e n c y ( Hz )= )

Scilab code Exa 7.5 calculating maximum error


1
2
3
4
5
6
7
8
9
10
11
12
13
14

// c a l c u l a t i n g maximum e r r o r
clc ;
R =5*10^6;
V =0.00005* R ;
disp (V , 0 . 0 0 5 p e r c e n t o f t h e r e a d i n g ( m i c r o s e c )= ) ;
LSD =1;
ME = V +1;
disp ( ME , Maximum e r r o r ( m i c r o s e c )= )
R =500;
V =0.00005* R ;
disp (V , 0 . 0 0 5 p e r c e n t o f t h e r e a d i n g ( s e c )= ) ;
LSD =1;
ME = V +1;
disp ( ME , Maximum e r r o r ( s e c )= )

Scilab code Exa 7.6 calculating number of turns and current


1

// c a l c u l a t i n g number o f t u r n s and c u r r e n t
102

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

clc ;
D =8*10^ -3;
A = D ^2;
disp (A , A= )
J =8*10^ -3;
K =16*10^ -3;
B =4* J * K ;
disp (B , B= )
disp ( s i n c e A<B s o t h e i n s t r u m e n t i s u n d e r d a n p e d )
th =(100* %pi ) /180;
i =10*10^ -3;
F =0.2*10^ -6;
G =( K * th + F ) / i ;
l =65*10^ -3;
d =25*10^ -3;
N = G /( B * l * d ) ;
disp (N , number o f t u r n s= )
i=F/G;
disp (i , c u r r e n t r e q u i r e d t o o v e r c o m e f r i c t i o n (A) )

Scilab code Exa 7.7 calculating speed of the tape


1
2
3
4
5
6

// c a l c u l a t i n g s p e e d o f t h e t a p e
clc ;
Lam =2.5*6.25;
f =50000;
S = Lam *10^ -6* f ;
disp (S , s p e e d (m/ s )= )

Scilab code Exa 7.8 calculating number density of the tape


1 // c a l c u l a t i n g number d e n s i t y
2 clc ;

103

of the tape

3 ND =12000/1.5;
4 disp ( ND , Number d e n s i t y ( numbers /mm) )

Scilab code Exa 7.9 Calculating possible phase angles


1
2
3
4
5
6
7

// C a l c u l a t i n g p o s s i b l e p h a s e a n g l e s
clc ;
Y1 =1.25;
Y2 =2.5;
PA = asind ( Y1 / Y2 ) ;
disp ( PA , p h a s e a n g l e ( d e g r e e ) )
disp ( p o s s i b l e a n g l e a r e 30 d e g r e e and 330 d e g r e e )

Scilab code Exa 7.10 Calculating possible phase angles


1 // C a l c u l a t i n g p o s s i b l e p h a s e a n g l e s
2 clc ;
3 disp ( i f s p o t g e n e r a t i n g p a t t e r n moves i n t h e
4
5
6
7
8
9
10
11
12
13
14
15
16
17

clockwise direction )
Y1 =0;
Y2 =5;
PA = asind ( Y1 / Y2 ) ;
disp ( PA , p h a s e a n g l e ( d e g r e e ) )
Y1 =2.5;
Y2 =5;
PA = asind ( Y1 / Y2 ) ;
disp ( PA , p h a s e a n g l e ( d e g r e e ) )
Y1 =3.5;
Y2 =5;
PA = asind ( Y1 / Y2 ) ;
disp ( PA , p h a s e a n g l e ( d e g r e e ) )
Y1 =2.5;
Y2 =5;
104

18 PA =180 -[ asind ( Y1 / Y2 ) ];
19 disp ( PA , p h a s e a n g l e ( d e g r e e ) )

105

Chapter 8
Metrology

Scilab code Exa 8.1 calculate the arrangement of slip gauges


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

// c a l c u l a t e t h e a r r a n g e m e n t o f s l i p g a u g e s
clc ;
Dd =52.215;
disp ( Dd , d e s i r e d v a l u e= )
Pb =4;
disp ( Pb , P r o t e c t e d b l o c k= )
R = Dd - Pb ;
disp (R , Reminder= )
Tp =1.005;
disp ( Tp , t h o u s a n d b l o c k= )
R =R - Tp ;
disp (R , Reminder= )
Hp =1.010;
disp ( Hp , H u n d e r t h s b l o c k= )
R =R - Hp ;
disp (R , Reminder= )
Ttp =2.20;
disp ( Ttp , t e n t h s b l o c k= )
R =R - Ttp ;
disp (R , Reminder= )
Up =4;
106

22 disp ( Up , u n i t b l o c k= )
23 R =R - Up ;
24 disp (R , Reminder= )
25 Tp =40;
26 disp ( Tp , Tens b l o c k= )
27 R =R - Tp ;
28 disp (R , Reminder= )

Scilab code Exa 8.2 calculate the sensitivity


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

// c a l c u l a t e t h e s e n s i t i v i t y
clc ;
Ps =200*10^3;
r =0.6;
d2 =0.5;
d1 =0.5;
a =( d2 / d1 ^2) ;
x1 =(1.1 - r ) /(2* a ) ;
disp ( x1 , x1= )
r =0.8;
d2 =0.5;
d1 =0.5;
a =( d2 / d1 ^2) ;
x2 =(1.1 - r ) /(2* a ) ;
disp ( x2 , x2= )
x = x1 - x2 ;
disp (x , s o t h e r a n g e i s x (mm) )
hS = %pi * d2 *10^ -3;
A2 = %pi * d2 *10^ -6*( x1 + x2 ) /2;
pS = -0.4* Ps / A2 ;
pgS =25*10^ -3/1000;
S = hS * pS * pgS ;
disp (S , s e n s i t i v i t y = )

107

Scilab code Exa 8.3 calculate uncertainity in displacement


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

// c a l c u l a t e u n c e r t a i n i t y i n d i s p l a c e m e n t
Pi =70*10^3;
r =0.4;
d2 =1.6;
d1 =0.75;
a =( d2 / d1 ^2) ;
x1 =(1.1 - r ) /(2* a ) ;
disp ( x1 , x1= )
r =0.9;
x2 =(1.1 - r ) /(2* a ) ;
disp ( x2 , x2= )
x = x1 - x2 ;
disp (x , s o t h e r a n g e i s x (mm) )
d = -2* a ;
Wr =12.5/ Pi ;
Wx = Wr / d ;
disp ( Wx , u n c e r t a i n i t y i n d i s p l a c e m e n t (mm) )

Scilab code Exa 8.4 calculate difference between height of workpieces and
pile of slip gauges
1
2
3
4
5
6

// c a l c u l a t e d i f f e r e n c e b e t w e e n h e i g h t o f w o r k p i e c e s
and p i l e o f s l i p g a u g e s
clc ;
N =12;
lem =0.644;
d = N * lem /2;
disp (d , d i f f e r e n c e b e t w e e n h e i g h t o f w o r k p i e c e s and
p i l e o f s l i p g a u g e s ( micro m e t e r ) )

108

Scilab code Exa 8.5 calculate seperation distance between two surfaces
and angle of tilt
1
2
3
4
5
6
7
8
9

// c a l c u l a t e s e p e r a t i o n d i s t a n c e b e t w e e n two
s u r f a c e s and a n g l e o f t i l t
clc ;
N =5;
lem =546*10^ -9;
d =[(2* N -1) * lem *10^6]/4;
disp (d , s e p e r a t i o n d i s t a n c e b e t w e e n two s u r f a c e s (
micro m e t e r ) )
x =75;
th = atan ( d / x ) ;
disp ( th , a n g l e o f t i l t )

Scilab code Exa 8.6 Calculate the difference in two diameters


1
2
3
4
5
6
7

// C a l c u l a t e t h e d i f f e r e n c e i n two d i a m e t e r s
clc ;
x =20/12;
L =50 -10;
lem =0.6;
d =( L * lem ) /(2* x ) ;
disp (d , d i f f e r e n c e i n d i a m e t e r s o f t h e r o l l e r s ( micro
m e t e r ) )

Scilab code Exa 8.7 Calculate the change in thickness along its length

109

1
2
3
4
5

// C a l c u l a t e t h e c h a n g e i n t h i c k n e s s a l o n g i t s
length
clc ;
d =4.5 -2.5;
Tg =2*(0.5) *0.509;
disp ( Tg , c h a n g e i n t h i c k n e s s a l o n g i t s l e n g t h ( micro
meter ) )

110

Chapter 9
Pressure Measurements

Scilab code Exa 9.1 calculating the length of mean free path
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

// c a l c u l a t i n g t h e l e n g t h o f mean f r e e p a t h
clc ;
T =273+20;
P =101.3*10^3;
mfp =22.7*10^ -6* T / P ;
disp ( mfp , l e n g t h o f mean f r e e p a t h when p r e s s u r e
one a t m o s p h e r i c p r e s s u r e (m) )
P =133;
mfp =22.7*10^ -6* T / P ;
disp ( mfp , l e n g t h o f mean f r e e p a t h when p r e s s u r e
one t o r r (m) )
P =133*10^ -3;
mfp =22.7*10^ -6* T / P ;
disp ( mfp , l e n g t h o f mean f r e e p a t h when p r e s s u r e
one m i c r o m e t e r o f Hg (m) )
P =249.1;
mfp =22.7*10^ -6* T / P ;
disp ( mfp , l e n g t h o f mean f r e e p a t h when p r e s s u r e
one i n c h o f w a t e r (m) )
P =133*10^ -6;
mfp =22.7*10^ -6* T / P ;
111

is

is

is

is

18

disp ( mfp , l e n g t h o f mean f r e e p a t h when p r e s s u r e i s


10 3 m i c r o m e t e r o f Hg (m) )

Scilab code Exa 9.2 Calculate Pressure of air source


1
2
3
4
5
6
7
8
9
10
11
12

// C a l c u l a t e P r e s s u r e o f a i r s o u r c e
clc ;
T =273+25;
P =99.22*10^3;
R =288;
df = P /( R * T ) ;
dm =0.82*996;
g =9.81;
h =200*10^ -6;
P1 = g * h *( dm - df ) *10^3;
Pa = P + P1 ;
disp ( Pa , P r e s s u r e o f a i r s o u r c e (N/m2) )

Scilab code Exa 9.3 Calculate Pressure head


1
2
3
4
5
6
7
8
9

// C a l c u l a t e P r e s s u r e head
clc ;
df =1*10^3;
dm =13.56*10^3;
g =9.81;
h =130*10^ -3;
P = g * h *( dm - df ) ;
Ph = P /9.81;
disp ( Ph , P r e s s u r e head (mm o f w a t e r ) )

112

Scilab code Exa 9.4 calculate height


1
2
3
4
5
6
7

// c a l c u l a t e h i g h t
clc ;
hn =250;
d =5;
D =25;
h = hn *(1+( d / D ) ^2) ;
disp (h , h e i g h t )

Scilab code Exa 9.6 calculate error interms of pressure


1
2
3
4
5
6
7
8
9
10

// c a l c u l a t e e r r o r i n t e r m s o f p r e s s u r e
clc ;
P =8*133;
h = P /(800*9.81) ;
d =2;
D =50;
hn = h /(1+( d / D ) ^2) ;
e =( hn - h ) / h *100;
eP =0.8*1000*9.81*( hn - h ) ;
disp ( eP , e r r o r i n t e r m s o f p r e s s u r e (N/m2) )

Scilab code Exa 9.7 calculate angle to which tube is incliend to vertical
1
2
3
4
5
6
7

// c a l c u l a t e a n g l e t o which t u b e i s i n c l i e n d t o
vertical
clc ;
P =133;
g =9.81;
dm =13.56*10^3;
R =10^ -3;
d =4;
113

8 D =20;
9 th = asind ( P /( g * dm * R *(1+( d / D ) ^2) ) ) ;
10 thV =90 - th ;
11 disp ( thV , a n g l e t o which t u b e i s i n c l i e n d

to

v e r t i c a l ( degree ) )

Scilab code Exa 9.8 calculate angle to which tube is incliend to horizontal
1
2
3
4
5
6
7
8
9
10

// c a l c u l a t e a n g l e t o which t u b e i s i n c l i e n d t o
horizontal
clc ;
P =9.81;
g =9.81;
dm =0.864*10^3;
R =4*10^ -3;
d =2;
D =20;
th = asind ( P /( g * dm * R *(1+( d / D ) ^2) ) ) ;
disp ( th , a n g l e t o which t u b e i s i n c l i e n d t o
horizontal ( degree ) )

Scilab code Exa 9.9 calculate Length of scale angle to which tube is incliend to horizontal
1
2
3
4
5
6
7
8

// c a l c u l a t e Length o f s c a l e a n g l e t o which t u b e i s
i n c l i e n d to h o r i z o n t a l
clc ;
P =500*9.81;
g =9.81;
d =8;
a = ( %pi /4) * d ^2;
A =1200;
dm =0.8*10^3;
114

9
10
11
12
13
14

hn = P /( g * dm *(1+( a / A ) ) ) ;
disp ( hn , Length o f s c a l e (m) )
R =0.6;
P1 =50*9.81;
th = asind ( P1 /( g * dm * R *[1+( a / A ) ]) ) ;
disp ( th , a n g l e t o which t u b e i s i n c l i e n d t o
horizontal ( degree ) )

Scilab code Exa 9.10 calculate diameter of the tube


1
2
3
4
5
6
7
8
9
10
11

// c a l c u l a t e d i a m e t e r o f t h e t u b e
clc ;
P =100*10^3;
g =9.81;
di =10*10^ -3;
D =40*10^ -3;
A = ( %pi /4) * D ^2;
dm =13.6*10^3;
a = A /[ P /( dm * g * di ) -1];
d =(4* a / %pi ) ^0.5*10^3;
disp (d , d i a m e t e r o f t h e t u b e (mm) )

Scilab code Exa 9.11 calculate amplification ratio and percentage error
1
2
3
4
5
6
7
8

// c a l c u l a t e a m p l i f i c a t i o n r a t i o and p e r c e n t a g e
error
clc ;
AR =1/(0.83 -0.8) ;
disp ( AR , A m p l i f i c a t i o n r a t i o )
D =50*10^ -3;
A = ( %pi /4) * D ^2;
d =6*10^ -3;
a = ( %pi /4) * d ^2;
115

9 PR =( a / A ) *100;
10 disp ( PR , p e r c e n t a g e

error )

Scilab code Exa 9.12 calculate value of counter weight required


1
2
3
4
5
6
7
8
9
10

// c a l c u l a t e v a l u e o f c o u n t e r w e i g h t r e q u i r e d
clc ;
P =981;
g =9.81;
d =500*10^ -3;
A = ( %pi /4) *(10*10^ -3) ^2;
R =275*10^ -3;
th =30;
W = A * d * P /(2* g * R * sind ( th ) ) ;
disp (W , v a l u e o f c o u n t e r w e i g h t r e q u i r e d ( kg ) )

Scilab code Exa 9.13 calculate damping factor time constant error and
time lag calculate damping factor natural frequency time constant error and
time lag
1
2
3
4
5
6
7
8
9
10
11

// c a l c u l a t e damping f a c t o r , t i m e c o n s t a n t , e r r o r
and t i m e l a g
// c a l c u l a t e damping f a c t o r , n a t u r a l f r e q u e n c y , t i m e
c o n s t a n t , e r r o r and t i m e l a g
clc ;
Mp1 =20/40;
Mp2 =10/40;
Mp3 =5/40;
Eta =0.225;
disp ( Eta , damping f a c t o r )
Td =1.2;
wd =2* %pi / Td ;
wn = wd /[(1 - Eta ^2) ^0.5];
116

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

tc =1/ wn ;
disp ( tc , t i m e c o n s t a n t ( s ) )
ess =2* Eta / wn ;
ess5 =5* ess ;
disp ( ess5 , e r r o r f o r 5mm/ s ramp (mm) )
Tlag =2* Eta * tc ;
disp ( Tlag , t i m e l a g ( s ) )
Eta1 = Eta *(0.5) ^0.5;
disp ( Eta1 , New damping f a c t o r )
Td =1.2;
wn1 = wn *(0.5) ^0.5;
disp ( wn1 , New n a t u r a l f r e q u e n c y ( r a d / s ) )
tc1 =1/ wn ;
disp ( tc1 , New t i m e c o n s t a n t ( s ) )
ess51 = ess5 ;
disp ( ess51 , new e r r o r f o r 5mm/ s ramp (mm) )
Tlag1 = Tlag ;
disp ( Tlag1 , new t i m e l a g ( s ) ) ;

Scilab code Exa 9.14 calculate thickness of diaphram and natural frequency
1
2
3
4
5
6
7
8
9
10
11

// c a l c u l a t e t h i c k n e s s o f diaphram and n a t u r a l
frequency
clc ;
P =7*10^6;
R =6.25*10^ -3;
v =0.28;
E =200*10^9;
t ={[9* P * R ^4*(1 - v ^2) /(16* E ) ]^0.25}*10^3;
disp (t , t h i c k n e s s o f diaphram (mm) )
ds =7800;
fn =[2.5* t /( %pi * R ^2) ]*[ E /(3* ds *(1 - v ^2) ) ]^0.5;
disp ( fn , n a t u r a l f r e q u e n c y ( Hz ) )

117

Scilab code Exa 9.15 calculate the natural length of the spring and dispacement
1
2
3
4
5
6
7
8
9
10
11
12
13

// c a l c u l a t e t h e n a t u r a l l e n g t h o f t h e s p r i n g and
dispacement
clc ;
P =100*10^3;
A =1500*10^ -6;
F=P*A;
Cs = F /3;
Ls = Cs +40;
disp ( Ls , n a t u r a l l e n g t h o f s p r i n g (mm) )
P1 =10*10^3;
F1 = P1 * A ;
Ss =3+2*.5;
D = F1 / Ss ;
disp (D , d i s p l a c e m e n t (mm) )

Scilab code Exa 9.16 calculate the open circuit voltage


1
2
3
4
5
6
7
8
9
10
11
12

// c a l c u l a t e t h e open c i r c u i t v o l t a g e
clc ;
P =200*10^3;
R =70*10^ -3;
v =0.25;
t =1*10^ -3;
r =60*10^ -3;
E =200*10^9;
Sr =[3* P * R ^2* v /(8* t ^2) ]*{(1/ v +1) -(3/ v +1) *( r / R ) ^2};
St =[3* P * R ^2* v /(8* t ^2) ]*{(1/ v +1) -(1/ v +3) *( r / R ) ^2};
Sta2 =( Sr - v * St ) / E ;
Sta3 =( Sr - v * St ) / E ;
118

13
14
15
16
17
18
19
20
21

r0 =10*10^ -3;
Sr1 =[3* P * R ^2* v /(8* t ^2) ]*{(1/ v +1) -(3/ v +1) *( r0 / R ) ^2};
St1 =[3* P * R ^2* v /(8* t ^2) ]*{(1/ v +1) -(1/ v +3) *( r0 / R ) ^2};
Sta1 =( Sr1 - v * St1 ) / E ;
Sta4 =( Sr1 - v * St1 ) / E ;
Gf =1.8;
ei =12;
eo =( Sta1 + Sta4 - Sta2 - Sta3 ) * Gf * ei /4;
disp ( eo , o u t p u t v o l t a g e (V) )

Scilab code Exa 9.17 calculate the optimum setting


1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17

// c a l c u l a t e t h e optimum s e t t i n g
clc ;
Aou =700*25*1/100;
Aol =100*25*1/100;
AouPtP = 2* Aou ;
AolPtP = 2* Aol ;
Se1 =1;
D1 = AouPtP / Se1 ;
disp ( D1 , d e f l e c t i o n o f s c r e e n c o r r e s p o n d i n g t o
maximum p r e s s u r e f o r s e n s i t i v i t y o f 1mV/mm (mm) )
disp ( s i n c h t h e l e n g t h o f t h e s c r e e n i s 100mm s o
waveform i s o u t o f r a n g e and h e n c e s e n s i t i v i t y
s e t t i n g o f 1mV/mm s h o u l d n o t be u s e d )
Se2 =5;
D2 = AouPtP / Se2 ;
disp ( D2 , d e f l e c t i o n o f s c r e e n c o r r e s p o n d i n g t o
maximum p r e s s u r e f o r s e n s i t i v i t y o f 5mV/mm (mm) )
disp ( d e l e c t i o n i s w i t h i n t h e r a n g e )
Se3 =20;
D3 = AouPtP / Se3 ;
disp ( D3 , d e f l e c t i o n o f s c r e e n c o r r e s p o n d i n g t o
maximum p r e s s u r e f o r s e n s i t i v i t y o f 20mV/mm (mm)
)
119

18 disp ( d e l e c t i o n i s w i t h i n t h e r a n g e )
19 Se4 =100;
20 D4 = AouPtP / Se4 ;
21 disp ( D4 , d e f l e c t i o n o f s c r e e n c o r r e s p o n d i n g t o

22
23
24
25

26
27

maximum p r e s s u r e f o r s e n s i t i v i t y o f 100mV/mm (mm)


)
disp ( d e l e c t i o n i s w i t h i n t h e r a n g e )
Se5 =500;
D5 = AouPtP / Se5 ;
disp ( D5 , d e f l e c t i o n o f s c r e e n c o r r e s p o n d i n g t o
maximum p r e s s u r e f o r s e n s i t i v i t y o f 500mV/mm (mm)
)
disp ( d e l e c t i o n i s w i t h i n t h e r a n g e )
disp ( s i n c e t h e s e n s i t i v i t y o f 5mV/mm g i v e s h i g h e r
d e f l e c t i o n s o i t i s t h e optimum s e n s i t i v i t y )

Scilab code Exa 9.18 calculate the output voltage of bridge


1
2
3
4
5
6
7
8
9

// c a l c u l a t e t h e o u t p u t v o l t a g e o f b r i d g e
clc ;
dP =(7000*10^3) -(100*10^3) ;
b =25*10^ -12;
R1 =100;
dR = R1 * b * dP ;
ei =5;
deo = dR * ei /(4* R1 )
disp ( deo , o u t p u t v o l t a g e o f b r i d g e (V) )

Scilab code Exa 9.19 calculate attenuation


1 // c a l c u l a t e
2 clc ;
3 T =273+20;

attenuation

120

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

P =101.3*10^3;
R =287;
de = P /( R * T ) ;
C =20.04* T ^0.5;
r =6.25*10^ -3;
L =0.6;
V = %pi *[(12.5*10^ -3) ^2]*(12.5*10^ -3) ;
wn = C * r *( %pi /( V *( L +0.5* %pi * r ) ) ) ^0.5;
fn = wn /(2* %pi ) ;
f =1000;
u = f / fn ;
mu =19.1*10^ -6;
eta =[2* mu /( de * C * r ^3) ]*[3* L * V / %pi ]^0.5;
M =1/{[(1 - u ^2) ^2]+[(2* eta * u ) ^2]}^0.5;
%M = M *100;
disp ( %M , a t t e n u a t i o n= )

Scilab code Exa 9.20 calculate error


1
2
3
4
5
6
7
8
9
10

// c a l c u l a t e e r r o r
clc ;
d =1;
At =( %pi * d ^2) *10^ -6/4;
V =100*10^ -6;
h =30*10^ -3;
P1 =( At * h ^2) / V ;
P2 =( At * h ^2) /( V - At * h ) ;
e = P2 - P1 ;
disp (e , e r r o r= )

121

You might also like