Electronic Measurements and Instrumentation_R. K. Rajput

Scilab Textbook Companion for Electronic Measurements and Instrumentation by R. K. Rajput1 Created by Mohd. Arif B.Tech

Views 97 Downloads 0 File size 363KB

Report DMCA / Copyright

DOWNLOAD FILE

Recommend stories

Citation preview

Scilab Textbook Companion for Electronic Measurements and Instrumentation by R. K. Rajput1 Created by Mohd. Arif B.Tech Electronics Engineering Uttarakhand Technical University College Teacher Mohd. Rijwan Cross-Checked by Lavitha Pereira and Mukul Kulkarni July 11, 2017

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: Electronic Measurements and Instrumentation Author: R. K. Rajput Publisher: S. Chand & Company Ltd. Edition: 2 Year: 2011 ISBN: 81-219-2917-2

1

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.

2

Contents List of Scilab Codes

4

1 concepts of measurements and electromechanical instruments

5

2 electronic instruments

54

5 Digital Instruments

74

6 instrument transformers

76

7 sensors and transducers

86

8 signal conditioning

100

12 measurement of non electrical quantities

102

13 Additional or supplement topics

106

3

List of Scilab Codes Exa Exa Exa Exa Exa

1.1.a 1.1.b 1.2 1.3.a 1.3.b

static error . . . . . . . . . . . . . . . . . . . . . . static correction for the voltmeter . . . . . . . . . temperature . . . . . . . . . . . . . . . . . . . . . absolute error and corrections . . . . . . . . . . . . express the error as the function of true value and scale deflection . . . . . . . . . . . . . . . . . . . . Exa 1.4.a static errors . . . . . . . . . . . . . . . . . . . . . . Exa 1.4.b static corrections . . . . . . . . . . . . . . . . . . . Exa 1.4.c relative static error . . . . . . . . . . . . . . . . . . Exa 1.5.a percentage error . . . . . . . . . . . . . . . . . . . Exa 1.5.b possible error . . . . . . . . . . . . . . . . . . . . . Exa 1.6 maximum possible error and root square accuracy Exa 1.7 maximum static error . . . . . . . . . . . . . . . . Exa 1.8 sensivity . . . . . . . . . . . . . . . . . . . . . . . Exa 1.9.a sensivity . . . . . . . . . . . . . . . . . . . . . . . Exa 1.9.b deflection factor . . . . . . . . . . . . . . . . . . . Exa 1.10 deflection . . . . . . . . . . . . . . . . . . . . . . . Exa 1.11 smallest change which can measured by transducer Exa 1.12 resolution . . . . . . . . . . . . . . . . . . . . . . . Exa 1.13 resolution . . . . . . . . . . . . . . . . . . . . . . . Exa 1.14 temperature change . . . . . . . . . . . . . . . . . Exa 1.15.b.ivoltmeter and milliameter readings . . . . . . . . . Exa 1.15.b.iivoltmeter and milliameter readings . . . . . . . . . Exa 1.18.a thermometer reading . . . . . . . . . . . . . . . . . Exa 1.18.b thermometer reading . . . . . . . . . . . . . . . . . Exa 1.19 temperature indicated . . . . . . . . . . . . . . . . Exa 1.20 time taken by the transducer . . . . . . . . . . . . Exa 1.21 time domain equation and its value . . . . . . . . . 4

. . . . . . . . full . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

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

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

1.22.a 1.22.b 1.23 1.24 1.25.a 1.25.b 1.26.a 1.26.b 1.27 1.28.a 1.28.b 1.29 1.30.a 1.30.b 1.31 1.32 1.34.b 1.35.a

Exa 1.36 Exa Exa Exa Exa

1.37 1.38 1.39 1.40

Exa Exa Exa Exa Exa Exa Exa Exa Exa

1.41 1.42 1.43 1.44 1.45 1.46 1.47 1.48.b 1.49

Exa 1.50.a

time constant . . . . . . . . . . . . . . . . . . . . . . . indicated temperature . . . . . . . . . . . . . . . . . . time constant . . . . . . . . . . . . . . . . . . . . . . . time altitude . . . . . . . . . . . . . . . . . . . . . . . ratio of output to input . . . . . . . . . . . . . . . . . time lag . . . . . . . . . . . . . . . . . . . . . . . . . . variation in the indicated temperature . . . . . . . . . time . . . . . . . . . . . . . . . . . . . . . . . . . . . . time constant and time lag . . . . . . . . . . . . . . . maximum and minimum values indicated by thermometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . phase shift and time lag . . . . . . . . . . . . . . . . . expression . . . . . . . . . . . . . . . . . . . . . . . . maximum value of temperature . . . . . . . . . . . . time lag . . . . . . . . . . . . . . . . . . . . . . . . . . output . . . . . . . . . . . . . . . . . . . . . . . . . . . expression of output . . . . . . . . . . . . . . . . . . . percentage reduction in mass . . . . . . . . . . . . . . damping ratio damped natural frequency static sensivity anf time constant . . . . . . . . . . . . . . . . . . . natural frequency damping ratio damped natural frequency and time constant . . . . . . . . . . . . . . . . effective damping ratio and undamped natural frequency determine the error . . . . . . . . . . . . . . . . . . . frequency range . . . . . . . . . . . . . . . . . . . . . expression output amplitude output frequency and phase lag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . range of readings . . . . . . . . . . . . . . . . . . . . . limiting error . . . . . . . . . . . . . . . . . . . . . . . limiting value and percent limiting error . . . . . . . . limiting error . . . . . . . . . . . . . . . . . . . . . . . magnitude and limiting error of resistance . . . . . . . error . . . . . . . . . . . . . . . . . . . . . . . . . . . . magnitude of power and magnitude of limiting error . true power . . . . . . . . . . . . . . . . . . . . . . . . arithemetic mean average deviation standard deviation and variance . . . . . . . . . . . . . . . . . . . . . . . arithemetic mean . . . . . . . . . . . . . . . . . . . . 5

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

Exa Exa Exa Exa

1.50.b 1.50.c 1.50.d 1.51

Exa 1.52 Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa

1.53 1.54 1.55 1.56 1.57 1.58 1.59 1.60 1.61 1.62 1.63 1.64 1.65 1.66 1.67 1.68 1.69 1.70 1.71 1.72 1.73 1.74 1.75 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8

average deviation . . . . . . . . . . . . . . . . . . . . . standard deviation . . . . . . . . . . . . . . . . . . . . variance . . . . . . . . . . . . . . . . . . . . . . . . . . mean standard deviation probable error of one reading and mean . . . . . . . . . . . . . . . . . . . . . . . . . arithematic mean average deviation standard deviation variance and probable error . . . . . . . . . . . . . . . standard deviation and probability of error . . . . . . readings . . . . . . . . . . . . . . . . . . . . . . . . . . number of readings . . . . . . . . . . . . . . . . . . . . probability of error and number of readings . . . . . . prescribed range . . . . . . . . . . . . . . . . . . . . . precision index and false alarms . . . . . . . . . . . . . rejected reading . . . . . . . . . . . . . . . . . . . . . linear relation and standard deviation . . . . . . . . . constants and relationship . . . . . . . . . . . . . . . . limiting error and standard deviation . . . . . . . . . . voltmeater and ammeter reading . . . . . . . . . . . . current and voltage . . . . . . . . . . . . . . . . . . . turning moment . . . . . . . . . . . . . . . . . . . . . error . . . . . . . . . . . . . . . . . . . . . . . . . . . . percentage error . . . . . . . . . . . . . . . . . . . . . readings . . . . . . . . . . . . . . . . . . . . . . . . . . power factor . . . . . . . . . . . . . . . . . . . . . . . true power power factor and line current . . . . . . . . reading . . . . . . . . . . . . . . . . . . . . . . . . . . percentage error . . . . . . . . . . . . . . . . . . . . . percentage error . . . . . . . . . . . . . . . . . . . . . power . . . . . . . . . . . . . . . . . . . . . . . . . . . kWh registered by the meter and percentage error . . ammeter current . . . . . . . . . . . . . . . . . . . . . error . . . . . . . . . . . . . . . . . . . . . . . . . . . . error . . . . . . . . . . . . . . . . . . . . . . . . . . . . input voltage . . . . . . . . . . . . . . . . . . . . . . . deflection voltage . . . . . . . . . . . . . . . . . . . . . deflection sensivity . . . . . . . . . . . . . . . . . . . . beam speed . . . . . . . . . . . . . . . . . . . . . . . . density of the magnetic field . . . . . . . . . . . . . . 6

35 36 36 37 39 40 40 41 41 42 42 43 44 45 46 46 47 47 48 49 49 50 50 51 51 52 52 53 54 54 55 55 56 57 57 58

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

2.9 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.35 5.1 5.2 5.3 6.1 6.2 6.3 6.4 6.5

Exa 6.6

voltage . . . . . . . . . . . . . . . . . . . . . . . . . . peak to peak value amplitude and rms value of signal . phase angles . . . . . . . . . . . . . . . . . . . . . . . resistance . . . . . . . . . . . . . . . . . . . . . . . . . resistance . . . . . . . . . . . . . . . . . . . . . . . . . constants of unknown arm . . . . . . . . . . . . . . . . constants of arm CD . . . . . . . . . . . . . . . . . . . resistance and capacitance . . . . . . . . . . . . . . . . series euivalent of unknown impedence . . . . . . . . . series euivalent of unknown inductance and resistance resistance capacitance and dissioation factor . . . . . . equivalent parralel resistance and capacitance . . . . . resistance and capacitance . . . . . . . . . . . . . . . . constants of arm CD . . . . . . . . . . . . . . . . . . . constant of Zx . . . . . . . . . . . . . . . . . . . . . . resistance and inductance . . . . . . . . . . . . . . . . capacitance power factor and relative permittivity . . distributed capacitance . . . . . . . . . . . . . . . . . distributed capacitance . . . . . . . . . . . . . . . . . resistive and reactive components of unknow impedence percentage error . . . . . . . . . . . . . . . . . . . . . self capacitance . . . . . . . . . . . . . . . . . . . . . . resistance and inductance . . . . . . . . . . . . . . . . inductance and capacitance . . . . . . . . . . . . . . . inductance and resistance . . . . . . . . . . . . . . . . Q factor and effective resistance . . . . . . . . . . . . self capacitance and inductance . . . . . . . . . . . . . frequency of the system . . . . . . . . . . . . . . . . . possible error . . . . . . . . . . . . . . . . . . . . . . . resolution . . . . . . . . . . . . . . . . . . . . . . . . . actual transformation ratio phase angle and maximum flux density . . . . . . . . . . . . . . . . . . . . . . . . ratio error and phase angle . . . . . . . . . . . . . . . flux and ratio error . . . . . . . . . . . . . . . . . . . . ratio error and phase angle error . . . . . . . . . . . . primary winding current actual transformation ration and number of turns . . . . . . . . . . . . . . . . . . . actual ratio and phase angle . . . . . . . . . . . . . . . 7

58 59 59 60 60 61 61 62 63 63 64 64 65 65 66 67 67 68 68 69 69 70 70 71 71 72 72 74 74 75 76 77 78 78 79 80

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

6.7 6.8 6.9 6.10 6.11 7.2 7.3 7.4 7.5 7.6 7.7.a 7.7.b 7.7.c 7.8 7.9 7.10 7.11 7.12 7.13 7.14 7.15 7.16 7.17 7.18 7.19 7.21

actual ratio and phase angle error . . . . . . . . . . . current nd phase angle error . . . . . . . . . . . . . . ratio error and phase angle . . . . . . . . . . . . . . . phase angle error and burden in VA . . . . . . . . . . ratio and phase angle error . . . . . . . . . . . . . . . displacement and resolution . . . . . . . . . . . . . . . resistance . . . . . . . . . . . . . . . . . . . . . . . . . inductance . . . . . . . . . . . . . . . . . . . . . . . . linearity . . . . . . . . . . . . . . . . . . . . . . . . . . sensivity and resolution . . . . . . . . . . . . . . . . . capacitance . . . . . . . . . . . . . . . . . . . . . . . . change in capacitance . . . . . . . . . . . . . . . . . . original capacitance and change in capacitance . . . . voltage output and charge sensivity . . . . . . . . . . . force . . . . . . . . . . . . . . . . . . . . . . . . . . . . strain charge and capacitance . . . . . . . . . . . . . . hall angle . . . . . . . . . . . . . . . . . . . . . . . . . voltage . . . . . . . . . . . . . . . . . . . . . . . . . . poissons ratio . . . . . . . . . . . . . . . . . . . . . . . change in resistance . . . . . . . . . . . . . . . . . . . change in length and amount of force . . . . . . . . . . strain . . . . . . . . . . . . . . . . . . . . . . . . . . . axial strain . . . . . . . . . . . . . . . . . . . . . . . . longitudinal and hoop stresses . . . . . . . . . . . . . modulus of elesticity and poissons ratio . . . . . . . . principa strains principal stresses maximum shrea stress and princiole planes . . . . . . . . . . . . . . . . . . . Exa 7.22 sensivity . . . . . . . . . . . . . . . . . . . . . . . . . Exa 8.1 total voltage gain . . . . . . . . . . . . . . . . . . . . . Exa 8.2 total gain and resultant gain . . . . . . . . . . . . . . Exa 12.1.b percentage change . . . . . . . . . . . . . . . . . . . . Exa 12.4 water flow rate . . . . . . . . . . . . . . . . . . . . . . Exa 12.5 rate of flow . . . . . . . . . . . . . . . . . . . . . . . . Exa 12.6 differecne in pressure head . . . . . . . . . . . . . . . . Exa 12.7 flow rate . . . . . . . . . . . . . . . . . . . . . . . . . Exa 12.8 speed of sub marine . . . . . . . . . . . . . . . . . . . Exa 13.1 resistance and inductance . . . . . . . . . . . . . . . . Exa 13.2 resistance and inductance . . . . . . . . . . . . . . . . 8

81 82 83 84 85 86 87 87 88 88 89 89 90 91 91 92 92 93 93 94 95 95 95 96 97 97 98 100 100 102 102 103 104 104 105 106 106

Exa 13.3 Exa 13.4

effective impedence . . . . . . . . . . . . . . . . . . . . capacitance and equivalent series . . . . . . . . . . . .

9

107 108

Chapter 1 concepts of measurements and electromechanical instruments

Scilab code Exa 1.1.a static error 1 2 3 4 5 6 7 8

// Example 1 . a : s t a t i c e r r o r clc , clear // g i v e n : vm =112.68; // v o l t m e t e r i n v o l t s vt =112.6; // v o l t a g e i n v o l t s Es = vm - vt ; disp ( Es , ” s t a t i c e r r o r , Es = (V) ” )

Scilab code Exa 1.1.b static correction for the voltmeter 1 2 // Example 1 . b : s t a t i c c o r r e c t i o n 3 clc , clear 4 // g i v e n : 5 vm =112.68; // v o l t m e t e r i n v o l t s

10

6 vt =112.6; // v o l t a g e i n v o l t s 7 Es = vm - vt ; 8 Cs = - Es ; 9 disp ( Cs , ” s t a t i c c o r e c t i o n , Cs = (V) ” )

Scilab code Exa 1.2 temperature 1 2 3 4 5 6 7 8

// Example 2 . : t r u e v a l u e o f t e m p e r a t u r e clc , clear // g i v e n : vm =92.35; // i n c e l c i u s cs = -0.07; // i n c e l c i u s Vt = vm + cs ; disp ( Vt , ” t r u e v a l u e o f t e m p e r a t u r e Vt = ( d e g r e e c e l c i u s ) ”)

Scilab code Exa 1.3.a absolute error and corrections 1 2 3 4 5 6 7 8 9 10

// Example 1 . 3 . a : a b s o l u t e e r r o r and c o r r e c t i o n clc , clear // g i v e n : vm =2.65; // i n v o l t s vt =2.70; // i n v o l t s Es = vm - vt ; Cs = - Es ; disp ( Es , ” a b s o l u t e e r r o r , Es = (V) ” ) disp ( Cs , ” c o r r e c t i o n , Cs = (V) ” )

11

Scilab code Exa 1.3.b express the error as the function of true value and full scale deflection 1 2 3 4 5 6 7 8 9 10 11

// Example 1 . 3 . b : r e l a t i v e e r r o r clc , clear // g i v e n : vm =2.65; // i n v o l t s vt =2.70; // i n v o l t s v =5; // f u l l s c a l e r a n g e o f v o l t a g e Es = vm - vt ; Er1 = Es / vt ; Er2 = Es / v ; disp ( ” r e l a t i v e e r r o r a s a f u n c t i o n o f t r u e v a l u e i s ” + string ( Er1 ) + ” o r ” + string (100* Er1 ) + ” %” ) 12 disp ( ” r e l a t i v e e r r o r a s a f u n c t i o n o f f u l l s c a l e d e f l e c t i o n i s ” + string ( Er2 ) + ” o r ” + string (100* Er2 ) + ” %” )

Scilab code Exa 1.4.a static errors 1 2 3 4 5 6 7

// Example 1 . 4 . a : s t a t i c e r r o r clc , clear // g i v e n : vm =42; // p r e s s u r e i n b a r vt =41.4; // p r e s s u r e i n b a r Es = vm - vt ; disp ( Es , ” s t a t i c e r r o r , Es = ( b a r ) ” )

Scilab code Exa 1.4.b static corrections 1 2

// Example 1 . 4 . b : c o r r e c t i o n 12

3 4 5 6 7 8 9

clc , clear // g i v e n : vm =42; // p r e s s u r e i n b a r vt =41.4; // p r e s s u r e i n b a r Es = vm - vt ; Cs = - Es ; disp ( Cs , ” s t a t i c c o r r c t i o n , Cs = ( b a r ) ” )

Scilab code Exa 1.4.c relative static error 1 2 3 4 5 6 7 8 9

// Example 1 . 4 . c : r e l a t i v e e r r o r clc , clear // g i v e n : vm =42; // p r e s s u r e i n b a r vt =41.4; // p r e s s u r e i n b a r Es = vm - vt ; Er = Es / vt ; disp ( ” r e l a t i v e e r r o r i s ” + string ( Er ) + ” o r ” + string (100* Er ) + ” %” )

Scilab code Exa 1.5.a percentage error 1 2 3 4 5 6 7 8 9

// Example 1 . 5 . a // t h e p e r c e n t a g e e r r o r on t h e b a s i s o f maximum s c a l e v a l u e clc ; clear ; close ; // g i v e n d a t a : P =50; // p r e s s u r e r a n g e i n b a r E =0.15; // may be +ve o r −ve i n b a r Pe =( E / P ) *100; disp ( Pe , ” t h e p e r c e n t a g e e r r o r , Pe (%)= ”); 13

Scilab code Exa 1.5.b possible error 1 2 3 4 5 6 7 8 9

// Example 1 . 5 . b // t h e p e r c e n t a g e e r r o r on t h e b a s i s o f i n d i c a t e d v a l u e o f 10 b a r p r e s s u r e clc ; clear ; close ; // g i v e n d a t a : P =10; // p r e s s u r e r a n g e i n b a r E =0.15; // may be +ve o r −ve i n b a r Pe =( E / P ) *100; disp ( Pe , ” t h e p e r c e n t a g e e r r o r , Pe (%)= ”);

Scilab code Exa 1.6 maximum possible error and root square accuracy 1 2 3 4 5 6 7 8 9 10 11 12

// Example 1 . 6 / / maximum p o s s i b l e e r r o r and r o o t square accuracy clc ; clear ; close ; // g i v e n d a t a : a =.3; // a c c u r a c y l i m i t s f o r t r a n s m i t t e r b =1.4; // a c c u r a c y l i m i t s f o r r e l a y c =0.9; // a c c u r a c y l i m i t s f o r r e c e i v e r Me = a + b + c ; Rs = sqrt (( a ^2) +( b ^2) +( c ^2) ) ; disp ( Me , ”maximum p o s s i b l e e r r o r , Me(%) = ”) disp ( Rs , ” r o o t s q a r e a c c u r a c y , Rs (%) = ”)

14

Scilab code Exa 1.7 maximum static error 1 2 3 4 5 6 7 8 9 10 11 12

// Example 1 . 7 / / maximum s t a t i c e r r o r clc ; clear ; close ; // g i v e n d a t a : s =.20; // i n % a =60; // p r e s s u r e g a u g e i n b a r b =5; // p r e s s u r e g a u g e i n b a r Pg =a - b ; Se =( s * Pg ) /100; disp ( Se , ”maximum s t a t i c e r r o r , Se ( b a r )=

”)

Scilab code Exa 1.8 sensivity 1 2 3 4 5 6 7 8 9

// Example 1 . 8 . s e n s i t i v i t y o f g a u g e clc , clear // g i v e n : C =60; // c a l i b r a t i o n p r e s s u r e F =(300* %pi ) /180; // f u l l s c a l e d e f l e c t i o n L = F *90; // l e n g t h o f s c a l e S=L/C; disp (S , ” s e n s i t i v i t y , S = (mm/ pa ) ” ) // a n s w e r i s c a l c u l a t e d i n t h e form o f p i i n t h e textbook

Scilab code Exa 1.9.a sensivity 1 // Example 1 . 9 . a . s e n s i t i v i t y 2 clc , clear 3 // g i v e n :

15

4 Mo =2.4; // m a g n i t u d e o f o u t p u t r e s p o n s e i n mm 5 Mi =6; // m a g n i t u d e o f i n p u t i n ohm 6 S = Mo / Mi ; 7 disp (S , ” s e n s i t i v i t y , S = (mm/ohm ) ” )

Scilab code Exa 1.9.b deflection factor 1 2 3 4 5 6 7

// Example 1 . 9 . b . d e f l e c t i o n f a c t o r clc , clear // g i v e n : Mo =2.4; // m a g n i t u d e o f o u t p u t r e s p o n s e i n mm Mi =6; // m a g n i t u d e o f i n p u t i n ohm D = Mi / Mo ; disp (D , ” d e f l e c t i o n f a c t o r = ( ohm/mm) ” )

Scilab code Exa 1.10 deflection 1 // Example 1 . 1 0 / / d e f l e c t i o n 2 clc ; 3 clear ; 4 close ; 5 S1 =6.8; // s e n s i v i t y o f t h e p i e z o e l e c t r i c 6 7 8 9 10 11 12

transducer i n pC/ b a r S2 =0.0032; // s e n s i v i t y o f t h e p i e z o e l e c t r i c t r a n s d u c e r i n V/ b a r S3 =16; // s e n s i v i t y o f t h e p i e z o e l e c t r i c t r a n s d u c e r i n mm/V OS = S1 * S2 * S3 ; // o v e r a l l s e n s i v i t y i n mm/ b a r CI =20; // c h a n g e b i n i n p u t p r e s s u r e CO = OS * CI ; // c h a n g e i n o u t put s i g n a l DC = CO ; // d e f l e c t i o n on t h e c h a r t mm disp ( DC , ” d e f l e c t i o n on t h e c h a r t i n mm” ) 16

Scilab code Exa 1.11 smallest change which can measured by transducer 1 2 3 4 5 6 7

// Example 1 . 1 1 . s m a l l e s t c h a n g e which can be m e a s u r e d by t h i s t r a n s d u c e r clc , clear // g i v e n : F =200; // r a n g e o f f o r c e i n N R =.15/100; // r e s o l u t i o n o f f u l l s c a l e Sc = R * F ; disp ( Sc , ” s m a l l e s t change , Sc = (N) ” )

Scilab code Exa 1.12 resolution 1 2 3 4 5 6 7 8 9 10 11 12

// Example 1 . 1 2 / / r e s o l u t i o n clc ; clear ; close ; // g i v e n d a t a : a =50; // u n i f o r m s c a l e b =50; // f u l l s c a l e r e a d i n g i n v o l t s c =1/10; O=a/b; R=O*c; disp (O , ” one s c a l e d i v i s i o n , O = ( v ) ” ) disp (R , ” r e s o l u t i o n , R = ( v ) ” )

Scilab code Exa 1.13 resolution 1

// Example 1 . 1 3 / / r e s o l u t i o n 17

2 3 4 5 6 7 8 9

clc ; clear ; close ; // g i v e n d a t a : D =1/9999; F =9.999; R=D*F; disp ( R *10^3 , ” r e s o l u t i o n , R(mv) = ” )

Scilab code Exa 1.14 temperature change 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 1 . 1 4 / / t e m p e r a t u r e r a n g e clc ; clear ; close ; // g i v e n d a t a : a =800; // c a l i b r a t i o n r a n g e i n c e l c i u s b =300; // c a l i b r a t i o n r a n g e i n c e l c i u s c =.11; // p e r c e n t a g e o f s p a n S =a - b ; D =(.11/100) *500; disp (S , ” s p a n o f p y r o m e t e r , S ( d e g r e e c e l c i u s ) = ” ) disp (D , ” dead zone , D( d e g r e e c e l c i u s ) = ” )

Scilab code Exa 1.15.b.i voltmeter and milliameter readings 1 // Example 1 . 1 5 . b . i // l o a d i n g e r r o r 2 clc ; 3 clear ; 4 close ; 5 // g i v e n d a t a : 6 Rv =125; // i n t e r n a l r e s i s t a n c e i n k i l o −ohm

18

7 8 9 10 11 12 13

V =180; // i n v o l t s I =6; // im m i l i −ampere Rt = V / I ; Ra = Rt ; Rat =( Rt * Rv ) /( Rv - Rt ) ; Le =(( Rat - Ra ) / Rat ) *100; disp ( Le , ” p e r c e n t a g e l o a d i n g e r r o r , Le (%) = ” )

Scilab code Exa 1.15.b.ii voltmeter and milliameter readings 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 1 . 1 5 . b . i i // l o a d i n g e r r o r clc ; clear ; close ; // g i v e n d a t a : Rv =125; // i n t e r n a l r e s i s t a n c e i n k i l o −ohm V =60; // i n v o l t s I =1.2; // ampere Rt = V / I ; Ra = Rt ; Rat =(( Rt /1000) * Rv ) /( Rv -( Rt /1000) ) ; Le =(( Rat -( Ra /1000) ) / Rat ) *100; disp ( Le , ” p e r c e n t a g e l o a d i n g e r r o r , Le (%) = ” )

Scilab code Exa 1.18.a thermometer reading 1 2 3 4 5 6

// Example 1 . 1 8 . a // what w i l l be t h e r e a d i n g o f t h e thermometer a f t e r 1 . 2 seconds . clc ; clear ; close ; // g i v e n d a t a : 19

7 8 9 10 11 12

Iin =160; // i n c e l c i u s t1 =1.2; // i n s e c o n d s t2 =2.2; // i n s e c o n d s I =20; // i n c e l c i u s Io = Iin *(1 -( exp ( - t1 / t2 ) ) ) ; disp ( Io , ” t h e r m o m e t e r r e a d i n g , I o ( d e g r e e c e l c i u s ) = ” )

Scilab code Exa 1.18.b thermometer reading 1 2 3 4 5 6 7 8 9 10 11 12

// Example 1 . 1 8 . b // d e t e r m i n e i t s r e a d i n g clc ; clear ; close ; // g i v e n d a t a : Iin =160; // i n c e l c i u s t1 =1.2; // i n s e c o n d s t2 =2.2; // i n s e c o n d s I =20; // i n c e l c i u s Io = Iin +( I - Iin ) * exp ( - t1 / t2 ) ; disp ( Io , ” t h e r m o m e t e r r e a d i n g , I o ( d e g r e e c e l c i u s ) = ” )

Scilab code Exa 1.19 temperature indicated 1 2 3 4 5 6 7 8

// Example 1 . 1 9 . / / c a l c u l a t e t h e t e m p e r a t u r e indicated clc ; clear ; close ; // g i v e n d a t a : Iin =160; // i n c e l c i u s t1 =10; // i n s e c o n d s t2 =5; // i n s e c o n d s 20

9 I =30; // i n c e l c i u s 10 Io = Iin +( I - Iin ) * exp ( - t1 / t2 ) ; 11 disp ( Io , ” t h e r m o m e t e r r e a d i n g , I o ( c e l c i u s ) = ” )

Scilab code Exa 1.20 time taken by the transducer 1

2 3 4 5 6 7 8 9

// Example 1 . 2 0 . / / c a l c u l a t e t h e t i m e t a k e n by t h e transducer to read h a l f of the temperature difference clc ; clear ; close ; // g i v e n d a t a : t1 =3; // i n s e c o n d s I =0.5; // i n c e l c i u s T =( - t1 ) *( log ( I ) ) ; disp (T , ” t h e t i m e t a k e n , T ( s e c o n d ) = ” )

Scilab code Exa 1.21 time domain equation and its value 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 1 . 2 1 . / / r e s i s t a n c e clc ; clear ; close ; // g i v e n d a t a : R1 =90; // s t a b l e r e s i s t a n c e t1 =12; // i n s e c o n d s t2 =4.8; // i n s e c o n d s G =.296; // s t e a d y s t a g e g a i n T =80; // c h a n g e o f t e m p e r a t u r e R=G*T; Rt = R *(1 - exp ( - t1 / t2 ) ) + R1 ; disp ( Rt , ” r e s i s t a n c e , Rt ( ohm ) = ” ) 21

Scilab code Exa 1.22.a time constant 1 2 3 4 5 6 7 8 9 10 11 12

// Example 1 . 2 2 . a // t h e t i m e c o n t a n t f o r t h e thermometer clc ; clear ; close ; // g i v e n d a t a : Iin =140; // i n c e l c i u s t1 =4; // i n s e c o n d s I =15; // i n c e l c i u s Io =75; // i n c e l c i u s a =( Io - Iin ) /( I - Iin ) ; t2 = - t1 /( log ( a ) ) ; disp ( t2 , ” t i m e c o n s t a n t i n s e c o n d s ” )

Scilab code Exa 1.22.b indicated temperature 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 1 . 2 2 . b // i n d i c a t e d t e m p e r a t u r e clc ; clear ; close ; // g i v e n d a t a : Iin =140; // i n c e l c i u s t1 =5; // i n s e c o n d s t2 =1; // i n c e l c i u s I =15; // i n c e l c i u s Io =75; // i n c e l c i u s Io = Iin +( I - Iin ) * exp ( - t1 / t2 ) ; disp ( Io , ” t h e r m o m e t e r r e a d i n g , I o ( d e g r e e c e l c i u s ) = ” ) 22

Scilab code Exa 1.23 time constant 1 2 3 4 5 6 7 8 9

// Example 1 . 2 3 . / / c a l c u l a t e t h e t i m e c o n s t a n t clc ; clear ; close ; // g i v e n d a t a : Ed =3.9; // dynamic e r r o r Si =0.2; // s l o p e i n c e l c i u s / s e c o n d s T = Ed / Si ; disp (T , ” t i m e c o n s t a n t , T( s e c o n d s ) = ” )

Scilab code Exa 1.24 time altitude 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// Example 1 . 2 4 . / / c a l c u l a t e t h e t i m e a l t i t u d e clc ; clear ; close ; // g i v e n d a t a : h =2500; // h e i g h t i n m e t e r t1 =8; // i n s e c o n d s a =5; // r a t e o f r i s e b a l l o o n i n m/ s b =30; // t e m p r e r a t u r e i n d i c a t e d a t an a l t i u d e o f 2500 m i n c e l c i u s c =.011; // r a t e o f t e m p e r a t u r e v a r i a t i o n w i t h a l t i t u d e i n c e l c i u s / meter y=c*a; Ed = y * t1 ; E = Ed / c ; A =h - E ; disp (A , ” a c t u a l a l t i t u d e , A( m e t e r ) = ” )

23

Scilab code Exa 1.25.a ratio of output to input 1 2 3 4 5 6 7 8 9 10

// Example 1 . 2 5 . a // t h e r a t i o o f o u t p u t t o i n p u t clc ; clear ; close ; // g i v e n d a t a : t1 =50; // i n s e c o n d s t2 =500; // i n s e c o n d s w =2* %pi / t2 ; I =1/ sqrt (1+( w * t1 ) ^2) ; disp (I , ” r a t i o o f o u t p u t t o i n p u t , I = ” )

Scilab code Exa 1.25.b time lag 1 2 3 4 5 6 7 8 9 10 11

// Example 1 . 2 5 . b // t h e t i m e l a g clc ; clear ; close ; // g i v e n d a t a : t1 =50; // i n s e c o n d s t2 =500; // i n s e c o n d s w =2* %pi / t2 ; P = atan ( w * t1 ) T =(1/ w ) * P disp (T , ” t h e t i m e l a g , T( s e c o n d s ) = ” )

Scilab code Exa 1.26.a variation in the indicated temperature

24

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

// Example 1 . 2 6 . a // t h e v a r i a t i o n i n t h e i n d i c a t e d temerature clc ; clear ; close ; // g i v e n d a t a : Iin =25; // may be +ve o r −ve t1 =20; // i n s e c o n d s t2 =4; // i n m i n u t e s f =1/( t2 *60) ; // c y c l e s / s e c w =2* %pi * f ; // r a d / s e c pi = atand ( w * t1 ) ; A = sin ( w * t2 - pi ) ; Io =( Iin / sqrt (1+( w * t1 ) ^2) ) ; disp ( Io , ” t h e v a r i a t i o n i n t h e i n d i a c a t e d t e m p e r a t u r e , Io ( degree c e l c i u s ) = ”)

Scilab code Exa 1.26.b time 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 1 . 2 6 . b // t h e l a g clc ; clear ; close ; // g i v e n d a t a : Iin =25; // may be +ve o r −ve t1 =20; // i n s e c o n d s t2 =4; // i n m i n u t e s f =1/( t2 *60) ; // c y c l e s / s e c w =2* %pi * f ; // r a d / s e c pi = atan ( w * t1 ) ; // i n r a d L =(1/ w ) * pi disp (L , ” t h e l a g , L ( s e c o n d s )= ” )

25

Scilab code Exa 1.27 time constant and time lag 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

// Example 1 . 2 7 // maximum t i m e c o n s t a n t clc ; clear ; close ; // g i v e n d a t a : f1 =90; // c y c l e s p e r s e c o n d s f =120; // f r e q u e n c y r e s p o n s e i n c y l c l e p e r s e c o n d w =2* %pi * f ; // r a d / s e c I =0.96 a =(1/ I ) ^2; b = sqrt ( a ) t =( b -1) / w ; tl = atan (2*( %pi ) * f1 * t ) ; // tla =(1/(2* %pi * f1 ) ) * tl ; // t i m e l a g i n s e c o n d s disp (t , ”maximum t i m e c o n s t a n t , t ( s e c ) = ” ) disp ( tla , ” t i m e l a g a t 90 c y c l e s p e r s e c o n d s i n seconds ”)

Scilab code Exa 1.28.a maximum and minimum values indicated by thermometer 1 2 3 4 5 6 7 8 9 10 11 12

// Example 1 . 2 8 . a // maximum and minimum v a l u e clc ; clear ; close ; // g i v e n d a t a : Iin =30; // i n c e l c i u s t1 =50; // i n s e c o n d s t2 =10; // i n s e c o n d s T1 =520; // s t a r t i n g r a n g e v a r i a t i o n o f t e m e r a t u r e T2 =580; // r a n g e v a r i a t i o n o f t e m p e r a t u r e T =( T1 + T2 ) /2; // mean v a l u e i n c e l c i u s w =2* %pi *(1/ t1 ) ; // a n g u l a r f r e q u e n c y o f o s c i l l a t i o n 26

13 14 15 16 17 18

rad / s e c a =1/ sqrt (1+( w * t2 ) ^2) ; Io = Iin * a ; Tmax = T + Io ; Tmin =T - Io ; disp ( Tmax , ”maximum t e m p e r a t u r e , Tmax ( c e l c i u s ) = ” ) disp ( Tmin , ”minimum t e m p e r a t u r e , Tmin ( c e l c i u s ) = ” )

Scilab code Exa 1.28.b phase shift and time lag // Example 1 . 2 8 . b // p h a s e s h i f t and t i m e clc ; clear ; close ; // g i v e n d a t a : Iin =30; // i n c e l c i u s t1 =50; // i n s e c o n d s t2 =10; // i n s e c o n d s T1 =520; // s t a r t i n g r a n g e v a r i a t i o n o f t e m e r a t u r e T2 =580; // r a n g e v a r i a t i o n o f t e m p e r a t u r e T =( T1 + T2 ) /2; // mean v a l u e i n c e l c i u s w =2* %pi *(1/ t1 ) ; // a n g u l a r f r e q u e n c y o f o s c i l l a t i o n rad / s e c 13 pi = atan ( w * t2 ) ; 14 L =(1/ w ) * pi ; 15 disp (L , ” t h e t i m e l a g , L ( s e c o n d s ) = ” ) 1 2 3 4 5 6 7 8 9 10 11 12

Scilab code Exa 1.29 expression 1 // Example 1 . 2 9 // o u t p u t 2 clc ; 3 clear ; 4 close ;

27

5 6 7 8 9 10 11 12 13

// g i v e n d a t a : Iin =0.35; // s i n u s o i d l i n p u t r e l a t i o n t =0.3; // s e c w =25; // r a d / s e c a =1/ sqrt (1+( w * t ) ^2) ; Io = Iin * a ; pi = atand ( w * t ) ; disp ( pi , ” t h e p h a s e s h i f t , p i ( c e l c i u s ) ” ) disp ( ” t h e o u t p u t e x p r e s s i o n , I o = 0 . 0 4 6 2 s i n ( 2 5 t − 8 2 . 4 ) ”)

Scilab code Exa 1.30.a maximum value of temperature 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// Example 1 . 3 0 . a // d e t e r m i n e t h e maximum v a l u e o f temperature clc ; clear ; close ; // g i v e n d a t a : T =20; // r a t e c h a n g e o f t e m p e r a t u r e may be +ve o r − ve i n c e l c i u s t =120; // i n s e c o n d s t1 =18; // t i m e c o n s t a n t f o r t h e b u l b i n s e c o n d s t2 =36; // t i m e c o n s t a n t f o r t h e w e l l i n s e c o n d s w =2* %pi *(1/ t ) ; a =1/ sqrt (1+( w * t1 ) ^2) ; b =1/ sqrt (1+( w * t2 ) ^2) ; I=a*b; Tmax = T * I ; disp ( Tmax , ” t h e maximum i n d i c a t e d t e m p e r a t u r e , Tmax ( celcius ) = ”)

Scilab code Exa 1.30.b time lag 28

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

// Example 1 . 3 0 . b // d e t e r m i n e t h e maximum v a l u e o f temperature clc ; clear ; close ; // g i v e n d a t a : T =20; // r a t e c h a n g e o f t e m p e r a t u r e may be +ve o r − ve i n c e l c i u s t =120; // i n s e c o n d s t1 =18; // t i m e c o n s t a n t f o r t h e b u l b i n s e c o n d s t2 =36; // t i m e c o n s t a n t f o r t h e w e l l i n s e c o n d s w =2* %pi *(1/ t ) ; A = atan ( w * t1 ) + atan ( w * t2 ) ; // a n g l e o f l a g L =(1/ w ) * A ; disp (L , ” t h e t i m e l a g , L ( s e c o n d s ) = ” )

Scilab code Exa 1.31 output 1 // Example 1 . 3 1 / / o u t p u t 2 clc ; 3 clear ; 4 close ; 5 t =1; // assume 6 I1 = 2* sin (2* t ) +0.5* sin (10* t ) ; // i n p u t c u r r e n t

equation 7 t1 =0.3; // t i m e c o n s t a n t i n s e c o n d s 8 Io = (( sin (2* t ) - atan (2* t1 ) ) /( sqrt (1+(2* t1 ) ^2) ) ) + ((

sin (10* t ) - atan (10* t1 ) ) /( sqrt (1+(10* t1 ) ^2) ) ) ; // output cu r r en t equation 9 disp ( ” o u t p u t c u r r e n t e q u a t i o n i s 0.857 s i n (2 t −30.96) +0.316 s i n (10 t −71.56) ”)

Scilab code Exa 1.32 expression of output 29

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

// Example 1 . 3 2 / / e x p r e s s i o n o f o u t p u t clc ; clear ; close ; // I 1 =2∗ s i n ( 2 ∗ t ) +0.2∗ c o s ( 8 ∗ t ) ; / / // I 1 =2∗ s i n ( 2 ∗ t ) −0.2∗ s i n ( 8 ∗ t+%pi ) ; / / w =2; // t =0.15; // s e c o m d s r =1/( sqrt (1+( w * t ) ^2) ) ; // mo = w * r ; // m a g n i t u d e pf = atand ( w * t ) ; // d e g r e e // I o=mo∗ s i n ( 2 ∗ t − 1 6 . 7 ) ; / / o u t p u t x =0.2 w1 =8; // t =0.15; // s e c o m d s r1 =1/( sqrt (1+( w1 * t ) ^2) ) ; // mo1 = x * r ; // m a g n i t u d e pf1 = atand ( w1 * t ) ; // d e g r e e // I o=mo1∗ s i n ( 8 ∗ t+%pi − 5 0 . 1 9 ) ; / / o u t p u t disp ( ” O v e r a l l o u t p u t i s 1 . 9 5 6 s i n ( 2 t − 1 6 . 7 ) −0.128 s i n ( 8 t+%pi − 5 0 . 1 9 ) ” )

Scilab code Exa 1.34.b percentage reduction in mass 1 2 3 4 5 6 7 8 9

// Example 1 . 3 4 . b // p e r c e n t a g e r e d u c t i o n i n mass clc ; clear ; close ; m =4.5; // mass i n grams PM =1.15; // p e r c e n t a g e i n c r e a s e i n mass m2 = m /( PM ^2) ; // new mass PCM = (m - m2 ) /( m ) ; //PERCENTAGE CHANGE IN MASS disp ( PCM *100 , ” p e r c e n t a g e c h a n g e i n mass i s ” )

30

Scilab code Exa 1.35.a damping ratio damped natural frequency static sensivity anf time constant 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 1 . 3 5 / / damping r a t i o n , damped n a t u r a l f r e q u e n c y , s t a t i c s e n s i v i t y and t i m e c o n s t a n t clc ; clear ; close ; k =1; // s t a t i c s e n s i v i t y wn = sqrt (30) ; // n a t u r a l f r e q u e n c y i n r a d / s y =(0.1* wn ) /2; // damping r a t i o wd = wn * sqrt (1 - y ^2) ; // damped n a t u r a l f r e q u e n c y i n r a d / s t =(1/ wn ) ; // t i m e c o n s t a n t i n s e c o n d s disp (y , ” damping r a t i o i s ” ) disp ( wd , ” damped n a t u r a l f r e q u e n c y i n r a d / s i s ” ) disp (k , ” s t a t i c s e n s i v i t y i s ” ) disp (t , ” t i m e c o n s t a n t i n s e c o n d s i s ” )

Scilab code Exa 1.36 natural frequency damping ratio damped natural frequency and time constant 1 2 3 4 5 6 7 8 9

// Example 1 . 3 6 / / damping r a t i o n , damped n a t u r a l f r e q u e n c y , n a t u r a l f r e q u e n c y and t i m e c o n s t a n t clc ; clear ; close ; q =1.22; // i n Nm/ r a d j =0.14; // i n kg m e t e r s q u a r e w =1.95; // f r e q u e n c y i n r a d / s wn = sqrt ( q / j ) ; // n a t u r a l f r e q u e n c y i n r a d / s y =( w / wn ) ; // damping r a t i o 31

10 y1 =0.555; // damping r a t i o

c o r r e s p o n d i n g t o maximum

p o s s i b l e e r r o r o f 8% 11 wd = wn * sqrt (1 - y1 ^2) ; // damped n a t u r a l

f r e q u e n c y in rad

/s 12 t =(1/ wn ) ; // t i m e c o n s t a n t i n s e c o n d s 13 disp ( wn , ” n a t u r a l f r e q u e n c y i n r a d / s ” ) 14 disp ( y1 , ” damping r a t i o i s ” ) 15 disp ( wd , ” damped n a t u r a l f r e q u e n c y i n r a d / s 16 disp (t , ” t i m e c o n s t a n t i n s e c o n d s i s ” )

i s ”)

Scilab code Exa 1.37 effective damping ratio and undamped natural frequency 1 2 3 4 5 6 7 8 9 10 11 12

// Example 1 . 3 7 : / / damping r a t i o and undamped n a t u r a l frequency clc ; clear ; PO =12; // p e r c e n t a g e o v e r s h h o t Rt =0.22; // r i s e t i m e i n s e c o n d s y =0.56; // damping r a t i o n wd =( %pi / Rt ) ; // damped n a t u r a l f r e q u e n c y wn =( wd /( sqrt (1 - y ^2) ) ) ; // fn =( wn /(2* %pi ) ) ; // undamped n a t u r a l f r e q u e n c y i n Hz disp (y , ” damping r a t i o i s ” ) disp ( fn , ” undamped n a t u r a l f r e q u e n c y i n Hz i s ” )

Scilab code Exa 1.38 determine the error 1 // Example 1 . 3 8 : / / p e r c e n t a g e e r r o r 2 clc ; 3 clear ; 4 fn =5; // n a t u r a l f r e q u e n c y i n kHz

32

f =7; // e x c i t a t i o n f r e q u e n c y i n kHz r = f / fn ; // r a t i o y =0.62; // damping r a t i o M = (1/( sqrt ((1 - r ^2) ^2+(2* y * r ) ^2) ) ) ; // a m p l i t u d e r a t i o E =(1 - M ) *100; // e r r o r due t o p r o x i m i t y o f e x c i t a t i o n frequency with the n a t u r a l frequency o f the system 10 disp (E , ” p e r c e n t a g e e r r o r due t o p r o x i m i t y o f e x c i t a t i o n frequency with the n a t u r a l frequency o f the system ”) 5 6 7 8 9

Scilab code Exa 1.39 frequency range 1 // Example 1 . 3 9 : / / f r e q u e n c y r a n g e 2 clc ; 3 clear ; 4 fn =800; // n a t u r a l f r e q u e n c y i n c p s 5 MD =12; //maximum amount o f d e v i a t i o n 6 7 8 9 10 11

12 13

in amplitude

ratio M1 =1.12; // M2 =0.88 r =0.904; // r a t i o y =0.62; // damping r a t i o f = fn * r ; // e x c i t a t i o n f r e q u e n c y i n c p s //When M=1.12 THE SOLUTION WILL HAVE IMAGINARY ROOTS AND THIS IMLIES THE OUTPUT WOULD NEVER BE 1 . 1 2 TIMES THE OUTPUT FOR ANY FREQUENCY disp (f , ” e x c i t a t i o n f r e q u e n c y i n c p s ” ) // t h e d e v i a t i o n r e m a i n s w i t h i n 12 p e r c e n t o f o u t p u t f o r t h e f r e q u e n c y r a n g e 0−723 c p s

Scilab code Exa 1.40 expression output amplitude output frequency and phase lag 33

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

// Example 1 . 4 0 : / / o u t p u t a m l i t u d e , o u t p u t f r e q u e n c y and p h a s e l a g clc ; clear ; f =0.6; // f r e q u e n c y i n h e r t z w =2* %pi * f ; // f r e q u e n c y i n r a d / s t =1; // I1 = sin ( w * t ) ; // c u r r e n t r = ((8/(( %i * w ) ^2+(4* %i * w ) +20) ) ) ; // r a t i o o f o u t put current to input current rm = sqrt (0.724^2+1.885^2) ; // m a g n i t u d e rp = atand (1.885/0.724) ; // p a h s e l a g Mo = 1/ rm ; // m a g n i t u d e o f o u t p u t disp (w , ” o u t p u t f r e q u e n c y i n r a d / s ” ) disp ( Mo , ” m a g n i t u d e o f a m p l i t u d e i s ” ) disp ( rp , ” p a h s e l a g i n d e g r e e i s ” )

Scilab code Exa 1.41 range of readings 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// Example 1 . 4 1 // r a n g e clc ; clear ; close ; // g i v e n d a t a : w =500; // i n w a t t E =1.5; // may be +ve o r −ve i n % Qs =50; // i n w a t t Le =( E /100) * w ; // may be +ve o r −ve Er =( Le / Qs ) *100; Me =( E /100) * Qs ; // may be +ve o r −ve w1 = Qs - Me ; w2 = Qs + Me ; disp ( w1 , ” s t r a t i n g r a n g e , w1 ( w a t t ) = ” ) disp ( w2 , ” l a s t r a n g e , w2 ( w a t t ) = ” )

34

Scilab code Exa 1.42 limiting error 1 2 3 4 5 6 7 8 9 10

// Example 1 . 4 2 : / / l i m i t t i n g e r r o r clc ; clear ; Er = 3; // f u l l s c a l e r e a d i n g Qs =2.5*10^ -6; // f u l l s c a l e r e a d i n g Fm =1.25*10^ -3; // f l o w m e a s u r e d by t h e m e t e r i n m e t e r cuber per seconds dQs = Er * Qs ; // m a g n i t u d e l i m i t i n g e r r r Er1 = dQs / Qs ; // r e l a t i v e e r r o r a t f l o w PEr = dQs /( Fm *10^ -3) ; // p e r c e n t a g e l i m i t i n g e r r o r disp ( PEr , ” p e e r c e n t a g e l i m i t i n g e r r o r i n p e r c e n t a g e in ”)

Scilab code Exa 1.43 limiting value and percent limiting error 1 2 3 4 5 6 7 8 9 10 11

// Example 1 . 4 3 : / / l i m i t t i n g v a l u e s and l i m i t i n g e r r o r clc ; clear ; R1 =25; // i n ohms ER1 =4; // p e r c e n t a g e e r r o r R2 =65; // i n ohms ER2 =4; // p e r c e n t a g e e r r o r R3 =45; // i n ohms ER3 =4; // p e r c e n t a g e e r r o r er = ( ER1 /100) *( R1 + R2 + R3 ) ; // m a g n i t u d e o f r e s u l t a n t resistance limiting error 12 r = ( R1 + R2 + R3 ) ; // m a g n i t u d e o f r e s u l t a n t r e s i s t a n c e 13 lr = ( er / r ) *100; // l i m i t i n g e r r o r 14 disp (r , ” m a g n i t u d e o f r e s u l t a n t r e s i s t a n c e i n ohms ” ) 35

15 16

disp ( er , ” r e s u l t a n e e r r o r i n p e r c e n t a g e i s ”) disp ( lr , ” p e r c e n t a g e l i m i t i n g e r r o r i n p e r c e n t a g e i s ”)

Scilab code Exa 1.44 limiting error 1 // Example 1 . 4 4 : / / l i m i t i n g e r r o r 2 clc ; 3 clear ; 4 lp =1.2; // l i m i t i n g e r r o r i n t h e measurement o f power 5 ll =0.8; // l i m i t i n g e r r o r i n t h e measurement o f

current 6 lr = lp +2* ll ; // l i m t i n g

e r r o r i n meaurement o f

resistance 7 disp ( lr , ” p e e r c e n t a g e l i m i t i n g e r r o r i n p e r c e n t a g e is ”)

Scilab code Exa 1.45 magnitude and limiting error of resistance // Example 1 . 4 5 : / / r e s i s t a n c e and l i m i t i n g e r r o r clc ; clear ; R1 =50; // i n ohms ER1 =0.5; // p e r c e n t a g e e r r o r R2 =500; // i n ohms ER2 =0.5; // p e r c e n t a g e e r r o r R3 =440; // i n ohms ER3 =0.5; // p e r c e n t a g e e r r o r R4 = ( R2 * R3 ) / R1 ; // unknown r e s i s t a n c e i n ohms dR4 =( ER1 + ER2 + ER3 ) ; // r e l a t i v e l i m i t i n g e r r o r i n unknown r e s i s t a n c e 12 lr = ( dR4 * R4 ) /100; // l i m i t i n g e r r o r i n ohms 13 R41 = R4 + lr ; //

1 2 3 4 5 6 7 8 9 10 11

36

14 R42 = R4 - lr ; // 15 disp ( R41 , ”VALUE OF RESISTANCE IN OHMS” ) 16 disp ( R42 , ”VALUE OF RESISTANCE IN OHMS” ) 17 disp ( lr , ” l i m i t i n g e r r o r i n OHMS i s ”)

Scilab code Exa 1.46 error // Example 1 . 4 6 : / / l i m i t i n g e r r o r clc ; clear ; dE =0.2; // e r r o e i n modulus o f e l e s t i c i t y d1 =0.01; // c h a n g e i n w i d t h b =4.5; // w i d t h dB = d1 / b ; // e r r o r i n w i d t h d2 =0.01; // c h a n g e i n w i d t h D =0.9; // w i d t h dD = d2 / D ; // e r r o r i n w i d t h d3 =0.01; // c h a n g e i n beam L =45; //BEAM dL = d3 / L ; // e r r o r i n beam d4 =0.1; // c h a n g e i n d e f l e c t i o n y =1.8; // d e f l e c t r i o n dy = d2 / D ; // e r r o r i n d e f l e c t i o n lr = ( dE + dB +3* dD +3* dL + dy ) ; // p e r c e n t a g e l i m i t i n g e r r o r disp ( lr , ” p e e r c e n t a g e l i m i t i n g e r r o r i n p e r c e n t a g e is ”) 19 // a n s w e r i s wrong i n t h e t e x t b o o k

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

Scilab code Exa 1.47 magnitude of power and magnitude of limiting error 1 // Example 1 . 4 7 : / / m a g n i t u d e and l i m i t i n g 2 clc ; 3 clear ;

37

error

F =4.26; // i n KG EF1 =0.02; // p e r c e n t a g e e r r o r L =382; // i n MM EL2 =1.2; // p e r c e n t a g e e r r o r R =1192; // i n ohms ER =1; // p e r c e n t a g e e r r o r T =60; // i n s e c o n d s Et =0.50; // p e r c e n t a g e e r r o r P = ((2* %pi *9.81* F * L * R ) /( T *10^6) ) ; // power i n kW lr =(( EF1 / F ) +( EL2 / L ) +( ER / R ) +( Et / T ) ) * P // l i m i t i n g e r r o r i n WATTS 14 disp (P , ” m a g n i t u d e o f power i n w a t t s ” ) 15 disp ( lr , ” l i m i t i n g e r r o r in watts i s ”) 4 5 6 7 8 9 10 11 12 13

Scilab code Exa 1.48.b true power 1 2 3 4 5 6 7 8

// Example 1 . 4 8 . b : / / t r u e power i s a p e r c e n t a g e o f t h e power clc ; clear ; dI =( -0.011) ; //ERROR IN CURRENT MEASUREMENT dR =0.0025; //ERROR IN RESISTANCE dP = 2* dI + dR ; // t o t a l r e l a t i v e e r r o r RP = (1/(1+ dP ) ) ; // t r u e power a s a p e r c e n t a g e o f o r i g n a l power disp ( RP *100 , ” t r u e power a s a p e r c e n t a g e o f o r i g n a l power ” )

Scilab code Exa 1.49 arithemetic mean average deviation standard deviation and variance 1

// Example 1 . 4 9 : / / ARITHEMATIC MEAN,AVERAGE DEVIATION ,STANDARD DEVIATION AND VARAIANCE 38

2 clc ; 3 clear ; 4 q

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

=[1.34 ,1.38 ,1.56 ,1.47 ,1.42 ,1.44 ,1.53 ,1.48 ,1.40 ,1.59]; // l e n g t h i n mm AM = mean ( q ) ; // a r i t h e m a t i c mean i n mm for i = 1:10 qb ( i ) = q ( i ) - AM ; end Q = [ qb (1) , qb (2) , qb (3) , qb (4) , qb (5) , qb (6) , qb (7) , qb (8) , qb (9) , qb (10) ]; // AV =( - qb (1) - qb (2) + qb (3) + qb (4) - qb (5) - qb (6) + qb (7) + qb (8) - qb (9) + qb (10) ) /10; // SD = stdev ( Q ) ; // s t a n d a r d d e v i a t i o n V = SD ^2; // v a r i a n c e disp ( AM , ” a r i t h e m a t i c mean i n mm” ) disp ( AV , ” a v e r a g e d e v i a t i o n ” ) disp ( SD , ” s t a n d a r d d e v i a t i o n i n mm” ) disp (V , ” v a r i a n c e i n mm s q u a r e ” )

Scilab code Exa 1.50.a arithemetic mean 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 1 . 5 0 . a // a r i t h m e t i c d e v i a t i o n clc ; clear ; close ; // g i v e n d a t a : n =8; a =412; b =428; c =423; d =415; e =426; f =411; g =423; 39

14 h =416; 15 q =( a + b + c + d + e + f + g + h ) / n ; 16 disp (q , ” t h e a r i t h m e t i c mean , q ( kHz ) = ” )

Scilab code Exa 1.50.b average deviation // Example 1 . 5 0 . b // a v e r a g e d e v i a t i o n clc ; clear ; close ; // g i v e n d a t a : n =8; a =412; b =428; c =423; d =415; e =426; f =411; g =423; h =416; q =( a + b + c + d + e + f + g + h ) / n ; d1 =a - q ; d2 =b - q ; d3 =c - q ; d4 =d - q ; d5 =e - q ; d6 =f - q ; d7 =g - q ; d8 =h - q ; d =( abs ( d1 ) + abs ( d2 ) + abs ( d3 ) + abs ( d4 ) + abs ( d5 ) + abs ( d6 ) + abs ( d7 ) + abs ( d8 ) ) / n ; 25 disp (d , ” t h e a v e r a g e d e v i a t i o n , d ( kHz ) = ” ) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

40

Scilab code Exa 1.50.c standard deviation // Example 1 . 5 0 . c // s t a n d a r d d e v i a t i o n clc ; clear ; close ; // g i v e n d a t a : n =8; a =412; b =428; c =423; d =415; e =426; f =411; g =423; h =416; q =( a + b + c + d + e + f + g + h ) / n ; d1 =a - q ; d2 =b - q ; d3 =c - q ; d4 =d - q ; d5 =e - q ; d6 =f - q ; d7 =g - q ; d8 =h - q ; d =( abs ( d1 ) + abs ( d2 ) + abs ( d3 ) + abs ( d4 ) + abs ( d5 ) + abs ( d6 ) + abs ( d7 ) + abs ( d8 ) ) / n ; 25 s = sqrt ((( d1 ^2) +( d2 ^2) +( d3 ^2) +( d4 ^2) +( d5 ^2) +( d6 ^2) +( d7 ^2) +( d8 ^2) ) /( n -1) ) ; 26 disp (s , ” t h e s t a n d a r d d e v i a t i o n ( kHz ) = ” ) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

Scilab code Exa 1.50.d variance 1 // Example 1 . 5 0 . d // v a r i a n c e 2 clc ;

41

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

clear ; close ; // g i v e n d a t a : n =8; a =412; b =428; c =423; d =415; e =426; f =411; g =423; h =416; q =( a + b + c + d + e + f + g + h ) / n ; d1 =a - q ; d2 =b - q ; d3 =c - q ; d4 =d - q ; d5 =e - q ; d6 =f - q ; d7 =g - q ; d8 =h - q ; d =( abs ( d1 ) + abs ( d2 ) + abs ( d3 ) + abs ( d4 ) + abs ( d5 ) + abs ( d6 ) + abs ( d7 ) + abs ( d8 ) ) / n ; 25 s = sqrt ((( d1 ^2) +( d2 ^2) +( d3 ^2) +( d4 ^2) +( d5 ^2) +( d6 ^2) +( d7 ^2) +( d8 ^2) ) /( n -1) ) ; 26 V = s ^2; 27 disp (V , ” t h e v a r i a n c e , V ( kHz ) ˆ2 = ” )

Scilab code Exa 1.51 mean standard deviation probable error of one reading and mean 1 2 // Example 1 . 5 0 . d // v a r i a n c e 3 clc ; 4 clear ;

42

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

close ; // g i v e n d a t a : n =10; a =39.6; b =39.9; c =39.7; d =39.9; e =40; f =39.8; g =39.9; h =39.8; i =40.4; j =39.7; q =( a + b + c + d + e + f + g + h + i + j ) / n ; d1 =a - q ; d2 =b - q ; d3 =c - q ; d4 =d - q ; d5 =e - q ; d6 =f - q ; d7 =g - q ; d8 =h - q ; d9 =i - q ; d10 =j - q ; d =( abs ( d1 ) + abs ( d2 ) + abs ( d3 ) + abs ( d4 ) + abs ( d5 ) + abs ( d6 ) + abs ( d7 ) + abs ( d8 ) + abs ( d9 ) + abs ( d10 ) ) / n ; s = sqrt ((( d1 ^2) +( d2 ^2) +( d3 ^2) +( d4 ^2) +( d5 ^2) +( d6 ^2) +( d7 ^2) +( d8 ^2) +( d9 ^2) +( d10 ^2) ) /( n -1) ) ; r1 =0.6745* s ; rm = r1 / sqrt (n -1) ; R =i - a ; disp (q , ” t h e a r i t h m e t i c mean , q ( d e g r e e c e l c i u s ) = ” ) disp (s , ” t h e s t a n d a r d d e v i a t i o n ( d e g r e e c e l c i u s ) = ” ) disp ( r1 , ” p r o b a b l e e r r o r o f one r e a d i n g , r 1 ( d e g r e e c e l c i u s ) = ”) disp ( rm , ” p r o b a b l e e r r o r o f mean , rm ( d e g r e e c e l c i u s ) = ”) disp (R , ” r a n g e , R( d e g r e e c e l c i u s ) = ” ) 43

Scilab code Exa 1.52 arithematic mean average deviation standard deviation variance and probable error 1 2 3 4 5 6 7 8 9 10 11 12 13

14 15 16 17 18 19 20 21 22 23

// Example 1 . 5 2 : / / ARITHEMATIC MEAN,AVERAGE DEVIATION ,STANDARD DEVIATION AND VARAIANCE clc ; clear ; T =[197 ,198 ,199 ,200 ,201 ,202 ,203 ,204 ,205]; // temperature in degree c e l s i u s f =[2 ,4 ,10 ,24 ,36 ,14 ,5 ,3 ,2]; // f r e q u e n c y o f o c c u r e n c e q =[ T (1) * f (1) ,T (2) * f (2) ,T (3) * f (3) ,T (4) * f (4) ,T (5) * f (5) ,T (6) * f (6) ,T (7) * f (7) ,T (8) * f (8) ,T (9) * f (9) ]; // AM =( q (1) + q (2) + q (3) + q (4) + q (5) + q (6) + q (7) + q (8) + q (9) ) /100; // a r i t h e m a t i c mean i n mm for i = 1:9 qb ( i ) = T ( i ) - AM ; end Q = [ qb (1) , qb (2) , qb (3) , qb (4) , qb (5) , qb (6) , qb (7) , qb (8) , qb (9) ]; // AV =( - qb (1) * f (1) - qb (2) * f (2) - qb (3) * f (3) - qb (4) * f (4) + qb (5) * f (5) + qb (6) * f (6) + qb (7) * f (7) + qb (8) * f (8) + qb (9) * f (9) ) /100; // SD = sqrt (219.72/100) ; // s t a n d a r d d e v i a t i o n V = SD ^2; // v a r i a n c e r1 = 0.6745* SD ; //PROBABLE ERROR OF ONE READING rm = r1 /( sqrt (100) ) ; // p r o b a b l e e r r o r o f t h e mean SGm = SD /10; // s t a n d a r d d e v i a t i o n o f t h e mean SDg = SGm /( sqrt (2) ) ; // s t a n d a r d d e v i a t i o n o f t h e standard deviation disp ( AM , ” a r i t h e m a t i c mean i n d e g r e e b c e l s i u s ” ) disp ( AV , ” a v e r a g e d e v i a t i o n i n d e g r e e c e l s i u s ” ) disp ( SD , ” s t a n d a r d d e v i a t i o n i n d e g r e e c e l s i u s ” ) disp (V , ” v a r i a n c e i n d e g r e e c e l s i u s s q u a r e ” ) 44

disp ( r1 , ” p r o b a b l e e r r o r o f t h e one r e a d i n g d e g r e e c e l s i u s ”) 25 disp ( rm , ” p r o b a b l e e r r o r o f t h e mean i n d e g r e e c e l s i u s ”) 26 disp ( SDg , ” s t a n d a r d d e v i a t i o n o f t h e s t a n d a r d d e v i a t i o n ”) 24

Scilab code Exa 1.53 standard deviation and probability of error 1 2 3 4 5 6 7 8 9 10 11

// Example 1 . 5 3 : / /STANDARD DEVIATION OF THE METER AND PROBABLITY OF ERROR clc ; clear ; x =0.8; // i n ampere y =0.5248; // SD = x / y ; // s t a n d a r d d e v i a t i o n x1 =1.2; // i n ampere y1 = x1 / SD ; // p r o b a b i l i t y o f e r r o r disp ( SD , ” s t a n d a r d d e v i a t i o n i s ” ) disp (2*0.2842*100 , ” p r o b a b l i t y o f an e r r o r f o r 1 . 2A in percentage i s ”) // t h u s 57% o f t h e r e a d i n g s a r e w i t h i n 1 . 2A OF THE TRUE VALUE

Scilab code Exa 1.54 readings 1 2 3 4 5 6 7

// Example 1 . 5 4 : / / r e a d i n g s clc ; clear ; x =25 -21.9; // i n mm r =2.1; // p r o b a b l e e r r o r SD = r /0.6745; // s t a n d a r d d e v i a t i o n y = x / SD ; // r a t i o 45

8 NR =2*0.3413*100; // no .

of readings having d e v i a t i o n

w i t h i n 3 . 1mm 9 NR1 =100 - NR ; // no .

o f r e a d i n g s EXCEEDING d e v i a t i o n OF

3 . 1mm 10 nor = round ( NR1 /2) ; // noumber o f

readings having

d e v i a t i o n o f 3 . 1mm 11 disp ( nor , ” number o f r e a d i n g s h a v i n g d e v i a t i o n o f 3 . 1 mm” )

Scilab code Exa 1.55 number of readings 1 // Example 1 . 5 5 : / /NUMBER OF RODS 2 clc ; 3 clear ; 4 a =5000 -1000; //NO. OF RODS WHERE LENGTH LIES BETWEEN 5

6 7 8 9 10 11

20MM AND 2 0 . 2 5MM PY =0.4; //PROBABLITY THAT ROBABILITY THAT 4 0 0 0 RODS HAVE A VLUE GREATER THAN 20MM AND LESS THAN 2 0 . 2 5 MM SD =(20.25 -20) /1.3; // s t a n d a r d d e v i a t i o n y =(20 -19.25) / SD ; // PY1 =0.4953; //ROBABILITY THAT 4 0 0 0 RODS HAVE A VLUE GREATER THAN 20MM AND LESS THAN 2 0 . 2 5MM NR =10000* PY1 //NO. OF RODS WHERE LENGTH LIES BETWEEN 1 9 . 2 5MM AND 20MM tr = NR + a ; // t o t a l number o f r o d s whose l e n g t h l i e betweem s p e c i f i e d l i m i t s o f 1 9 . 5mm and 2 0 . 2 5mm disp ( tr , ” t o t a l number o f r o d s whose l e n g t h l i e betweem s p e c i f i e d l i m i t s o f 1 9 . 5mm and 2 0 . 2 5mm” )

Scilab code Exa 1.56 probability of error and number of readings 1

// Example 1 . 5 6 : / / p r o b a b i l i t y e r r o r and r e a d i n g s 46

2 3 4 5 6 7 8 9 10

clc ; clear ; d =15; // d e v i a t i o n i n r . p .m h =0.04; // p r e c i s i o n i n d e x SD =(1/( sqrt ( h ) ) ) ; // s t a n d a r d d e v i a t i o n y = d / SD ; // py =0.3015; // p r o b a b l i t y pr = 2* py ; // p r o b a b l i t y o f an e r r o r r =0.6*20; // no . o f r e a d i n g s l i e b e t w e e n 1 4 8 5 t o 1 5 1 5 r . p .m 11 disp ( pr , ” p r o b a b i l i t y o f an e r r o r 1 5 rpm i s ,= ” ) 12 disp (r , ” no . o f r e a d i n g s l i e b e t w e e n 1 4 8 5 t o 1 5 1 5 r . p .m” )

Scilab code Exa 1.57 prescribed range 1 // Example 1 . 5 7 : / / p r e s c r i b e d r a n g e 2 clc ; 3 clear ; 4 p1 =(40 -10) /40; // p r o b a b l i t y o f f a l l i n g 5 6 7 8 9 10 11

in pa r ti cu la r range py = p1 /2; // p r o b a b l i t y h =9; // p r e c i s i o n i n d e x SD =(1/( sqrt ( h ) ) ) ; // s t a n d a r d d e v i a t i o n y =1.15; // d = y * SD ; // d e v i a t i o n disp (d , ” s t a n d a r d d e v i a t i o n i s ” ) disp ( ” 75% o f t h e d e p t h measurement l i e w t i h t h e r a n g e o f ( 1 5 0 . 0 9 0 4 ) cm” )

Scilab code Exa 1.58 precision index and false alarms 1

// Example 1 . 5 8 : / / p r e c i s i o n i n d e x and f a l s e a l a r m s 47

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

clc ; clear ; y =0.675; // x =4.8; // SD = x / y ; //STANDARD DEVIATION h =(1/( sqrt (2) * SD ) ) ; // p r e c i s i o n i n d e x x1 =100 -88; // y = x1 / SD ; // py =0.45; // p r o b a b l i t y nm =30*4; // no . o f m e a s u r e m e n t s i n t h e month o f november fa = nm *0.05; // e x p e c t e d no . o f f a l s e a l a r m s rfa = fa /2; // r e d u c e d no . o f f a l s e a l a r m s pfa =( rfa / nm ) *100; // p r o b a b l i t y o f f a l s e a l a r m s py1 =0.5 -0.025; // p r o b a b l i t y o f d a t a l i e i n t h e t o l e r a n t band SD1 =(100 -88) /1.96; // h1 =((1/( sqrt (2) * SD1 ) ) ) ; //PRCESION INDEX disp (h , ” p r e c i s i o n i n d e x i n p a r t a ” ) disp ( fa , ” e x p e c t e d no . o f f a l s e a l a r m s ” ) disp ( h1 , ” p r e c i s i o n i n d e x i n p a r t b i s ” )

Scilab code Exa 1.59 rejected reading 1 // Example 1 . 5 9 : / / READING 2 clc ; 3 clear ; 4 q

5 6 7 8 9

=[5.30 ,5.73 ,6.77 ,5.26 ,4.33 ,5.45 ,6.09 ,5.64 ,5.81 ,5.75]; // l e n g t h i n mm AM = mean ( q ) ; // a r i t h e m a t i c mean i n mm for i = 1:10 qb ( i ) = q ( i ) - AM ; end Q = [ qb (1) , qb (2) , qb (3) , qb (4) , qb (5) , qb (6) , qb (7) , qb (8) , 48

10 11 12 13 14 15 16 17 18 19

qb (9) , qb (10) ]; // AV =( - qb (1) - qb (2) + qb (3) + qb (4) - qb (5) - qb (6) + qb (7) + qb (8) - qb (9) + qb (10) ) /10; // SD = stdev ( Q ) ; // s t a n d a r d d e v i a t i o n for i =1:10 B ( i ) = ( qb ( i ) ) / SD ; // disp ( B ( i ) ) end V = SD ^2; // v a r i a n c e disp ( AM , ” a r i t h e m a t i c mean i n mm” ) disp ( SD , ” s t a n d a r d d e v i a t i o n i n mm” ) disp ( ” i t i s g i v e n t h a t f o r 10 r e a d i n g s t h e r a t i o o f d e v i a t i o n to standard d e v i a t i o n i s not to exceed 1 . 9 6 and t h e r e f o r e r e a d i n g no . 5 i . e . 4 . 3 3m s h o u l d be r e j e c t e d ” )

Scilab code Exa 1.60 linear relation and standard deviation 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

// Example 1 . 6 0 : / / s t a n d a r d d e v i a t i o n clc ; clear ; u1 =[1.8 ,4.6 ,6.6 ,9.0 ,11.4 ,13.4]; // v1 =[2.2 ,3.2 ,5.2 ,6.4 ,8.0 ,10.0]; // for i = 1:6 m ( i ) = u1 ( i ) * v1 ( i ) d ( i ) = u1 ( i ) ^2; // end su = u1 (1) + u1 (2) + u1 (3) + u1 (4) + u1 (5) + u1 (6) ; sv = v1 (1) + v1 (2) + v1 (3) + v1 (4) + v1 (5) + v1 (6) ; sm = m (1) + m (2) + m (3) + m (4) + m (5) + m (6) ; // sd = d (1) + d (2) + d (3) + d (4) + d (5) + d (6) ; // a = ((6* sm ) -( su * sv ) ) /((6* sd ) -( su ) ^2) ; // b =(( sv * sd ) -( sm * su ) ) /((6* sd ) -( su ) ^2) ; // disp (a , ” v a r i a b l e a i s ” ) disp (b , ” v a r i a b l e b i s ” ) 49

18 19 20 21 22 23 24 25 26 27 28 29 30 31

disp ( ” b e s t l i n e a r e q u a t i o n i s 0 . 6 7 2 u + 0 . 5 9 1 ” ) for i =1:6 x ( i ) = a * u1 ( i ) +b - v1 ( i ) dx ( i ) = x ( i ) ^2 end sdx = dx (1) + dx (2) + dx (3) + dx (4) + dx (5) + dx (6) ; // SD = sqrt ( sdx /6) ; // SDu = SD / a ; // d e v i a t i o n o f u SDa = sqrt ((6) /((6* sd ) -( su ^2) ) ) * SD ; // s t a n d a r d deviation in a SDb = sqrt (( sd ) /((6* sd ) -( su ^2) ) ) * SD ; // s t a n d a r d deviation in b disp ( SD , ” s t a n d a r d d e v i a t i o n i s ”) disp ( SDu , ” s t a n d a r d d e v i a t i o n i n u i s ”) disp ( SDa , ” s t a n d a r d d e v i a t i o n i n a i s ”) disp ( SDb , ” s t a n d a r d d e v i a t i o n i n b i s ”)

Scilab code Exa 1.61 constants and relationship 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

// Example 1 . 6 1 : / / s t a n d a r d d e v i a t i o n clc ; clear ; u1 =[550 ,700 ,850 ,1000]; // v1 =[0.04182 ,0.04429 ,0.05529 ,0.0610]; // for i = 1:4 m ( i ) = u1 ( i ) * v1 ( i ) d ( i ) = u1 ( i ) ^2; // end su = u1 (1) + u1 (2) + u1 (3) + u1 (4) ; sv = v1 (1) + v1 (2) + v1 (3) + v1 (4) ; sm = m (1) + m (2) + m (3) + m (4) ; // sd = d (1) + d (2) + d (3) + d (4) ; // a = ((4* sm ) -( su * sv ) ) /((4* sd ) -( su ) ^2) ; // b =(( sv * sd ) -( sm * su ) ) /((4* sd ) -( su ) ^2) ; // disp (a , ” v a r i a b l e a i s ” ) 50

disp (b , ” v a r i a b l e b i s ” ) disp ( ” b e s t l i n e a r e q u a t i o n i s 4 5 . 7 ∗ 1 0 ˆ − 6 ∗ f ˆ2+15.18∗10ˆ −3∗ f i n mW” ) 19 // v a l u e o f a and b i s wrong i n t h e book 17 18

Scilab code Exa 1.62 limiting error and standard deviation 1 2 3 4 5 6 7 8 9

10 11 12

// Example 1 . 6 2 . l i m i t i n g e r r o r and s t a n d a r d deviation clc , clear // g i v e n : q1 =50; q2 =100; dq1 =0.02; // may be +ve o r −ve dq2 =0.01; // may be +ve or −ve Le =((( q1 /( q1 + q2 ) ) * dq1 ) +(( q2 /( q1 + q2 ) ) * dq2 ) ) *100; Re = sqrt (1+1) ; // when i n d i v i d u l e r r o r a r e s t a n d a r d d e v i a t i o n , t h e n e r r o r s i n i n d i v i d u a l measurement a r e 2% o f 50 and 1% o f 100 i e . , 1 and 1 Sd =( Re /( q1 + q2 ) ) *100; disp ( Le , ” l i m i t i n g e r r o r , Le (%) = ” ) disp ( Sd , ” s t a n d a r d d e v i a t i o n , Sd (%) = ” )

Scilab code Exa 1.63 voltmeater and ammeter reading 1 2 3 4 5 6 7 8

// Example 1 . 6 3 . r e s i s t a n c e clc , clear // g i v e n : Im =0.1; // maximum c u r r e n t i n A V =10; // v o l t a g e i n v o l t s Rm =2.5; // r e s i s t a n c e i n ohm Rs =( V / Im ) - Rm ; I =10; // i n A 51

9 Rsh =( Im * Rm ) /( I - Im ) ; 10 disp ( Rs , ” r e s i s t a n c e i n s e r i e s , Rs ( ohm ) = ” ) 11 disp ( Rsh , ” r e s i s t a n c e i n p a r a l l e l , Rsh ( ohm ) = ” )

Scilab code Exa 1.64 current and voltage 1 2 3 4 5 6 7 8 9 10 11

// Example 1 . 6 4 . r e s i s t a n c e clc , clear // g i v e n : Rm =10; // i n ohm Im =.005; // i n A I =1; // i n A V =5; Rsh =( Im * Rm ) /( I - Im ) ; Rs =( V -( Im * Rm ) ) / Im ; disp ( Rsh , ” s h u n t r e s i s t a n c e , Rsh ( ohm ) = ” ) disp ( Rs , ” s e r i e s r e s i s t a n c e , Rs ( ohm ) = ” )

Scilab code Exa 1.65 turning moment 1 2 3 4 5 6 7 8 9

// Example 1 . 6 5 . t u r n i n g moment clc , clear // g i v e n : l =0.03; // i n m B =0.09; // i n Wb/mˆ2 I =0.01; // i n A N =100; // number o f t u r n T =( N * B * I * l ^2) ; disp (T , ” t u r n i n g moment , T(N−m) = ” )

52

Scilab code Exa 1.66 error 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

// Example 1 . 6 6 / / p e r c e n t a g e e r r o r clc ; clear ; close ; // g i v e n d a t a : alfa_c =.4/100; // i n p e r d e g r e e c e l c i u s alfa_m =0.015/100; // i n p e r d e g r e e c e l c i u s Rm =5; // i n ohm Im =0.015; // i n A I =100; // i n A Ish =I - Im ; Vsh = Im * Rm ; Rsh = Vsh / Ish ; a =20; // i n d e g r e e c e l c i u s Rsh1 = Rsh *(1+( a * alfa_m ) ) ; // t h e s h u n t r e s i s t a n c e a f t e r a r i s e o f 20 d e g r e e c e l c i u s R1 =5; // i n t e r n a l r e s i s t a n c e i n ohm R2 =1; // c o p p e r r e s i s t o r i n ohm R3 =4; // manganin swamping r e s i s t o r i n ohm Ri = R1 *(1+20* alfa_c ) ; // c u r r e n t t h r o u g h t h e i n s t r u m e n t c o r r e s p o n d i n g t o 100 A I1 =( Rsh1 /( Ri + Rsh1 ) ) *100; Ii =( I1 * I ) / Im ; Pe1 =I - Ii ; Ri1 =( R2 *(1+20* alfa_c ) ) +( R3 *(1+20* alfa_m ) ) ; // i n s t r u m e n t c u r r e n t w i t h a l i n e c u r r e n t o f 100 A Il =( Rsh1 /( Ri1 + Rsh1 ) ) *100; Ir = Il *(100/ Im ) ; Pe2 =100 - Ir ; disp ( Pe1 , ” t h e p e r c e n t a g e e r r o r , Pe1 ( low ) = ” ) disp ( Pe2 , ” t h e p e r c e n t a g e e r r o r , Pe2 ( low ) = ” )

53

Scilab code Exa 1.67 percentage error 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

// Example 1 . 6 7 / / p e r c e n t a g e e r r o r clc ; clear ; close ; // g i v e n d a t a : f =100; // i n Hz V1 =250; // i n v o l t s I1 =0.05; // i n A L =1; // i n H R = V1 / I1 ; V =250; // i n v o l t s XL =2* %pi * f * L ; Z = sqrt ( R ^2+ XL ^2) ; Vr =( V1 * R ) / Z ; Ve = Vr - V ; Pe = abs ( Ve / V ) *100; disp ( Pe , ” p e r c e n t a g e e r r o r , Pe = ” )

Scilab code Exa 1.68 readings 1 2 3 4 5 6 7 8 9 10

// Example 1 . 6 8 / / v o l t m e t e r r e a d i n g clc ; clear ; close ; // g i v e n d a t a : f1 =25; // i n Hz f2 =100; // i n Hz R =300; // i n ohm L =0.12; // i n H XL1 =2* %pi * f1 * L ; 54

11 12 13 14 15 16 17 18

V_ac =15; // i n v o l t s Z1 = sqrt ( R ^2+ XL1 ^2) ; Vr1 = V_ac *( R / Z1 ) ; XL2 =2* %pi * f2 * L ; Z2 = sqrt ( R ^2+ XL2 ^2) ; Vr2 = V_ac *( R / Z2 ) disp ( Vr1 , ” t h e v o l t m e t e r r e a d i n g a t f 1 , Vr1 (V) = ” ) disp ( Vr2 , ” t h e v o l t m e t e r r e a d i n g a t f 2 , Vr1 (V) = ” )

Scilab code Exa 1.69 power factor 1 2 3 4 5 6 7 8 9 10

// Example 1 . 6 9 / / power f a c t o r clc ; clear ; close ; // g i v e n d a t a : W1 =920; // i n w a t t W2 =300; // i n w a t t fi = atand ( sqrt (3) *( W1 - W2 ) /( W1 + W2 ) ) ; cos_fi = cosd ( fi ) disp ( cos_fi , ” t h e power f a c t o r , c o s f i ( l a g ) = ” )

Scilab code Exa 1.70 true power power factor and line current 1 2 3 4 5 6 7 8 9

// Example 1 . 7 0 / / power f a c t o r and l i n e c u r r e n t clc ; clear ; close ; // g i v e n d a t a : W1 =14.2; // i n k−w a t t W2 = -6.1; // i n k−w a t t El =440; // i n v o l t s P = W1 + W2 ; 55

10 fi = atand ( sqrt (3) *( W1 - W2 ) /( W1 + W2 ) ) ; 11 cos_fi = cosd ( fi ) ; 12 IL = P *1000/( sqrt (3) * El * cos_fi ) ; 13 disp (P , ” t r u e power , P( k−w a t t ) = ” ) 14 disp ( cos_fi , ” t h e power f a c t o r , c o s f i ( l a g ) = ” ) 15 disp ( IL , ” t h e l i n e c u r r e n t , IL (A) = ” )

Scilab code Exa 1.71 reading 1 2 3 4 5 6 7 8 9 10 11 12 13 14

// Example 1 . 7 1 / / READING clc ; clear ; close ; Pi =25; // i n kW El =440; // l i n e v o l t a g e i n v o l t s pf =0.6; // power f a c t o r ph = acosd ( pf ) ; // tp = tan ( ph ) ; // dw =( tp * Pi ) /((3) ^(1/3) ) ; // c h a n g e i n w e i g h t s W1 =22.12; // IN kW W2 =25 - W1 ; // disp ( W1 , ” r e a d i n g i n kW” ) disp ( W2 , ” r e a d i n g i n kW” )

Scilab code Exa 1.72 percentage error 1 2 3 4 5 6 7

// Example 1 . 7 2 / / p e r c e n t a g e e r r o r clc ; clear ; I =5; // c u r r e n t i n ampere V =230; // v o l t s pf =1; // power f a c t o r 56

n =60; // no . o f r e v o l u t i o n s t =360; // t o t a l t i m e i n s e c o n d s nr =520; // n o r m a l d i s c no . o f r e v o l u t i o n s p e r kWh E =(( V * I * pf *360) /(3600*1000) ) ; // e n e r g y consumed i n 360 s e c o n d s i n kWh 12 Er = n / nr ; // e n e r g y r e c o r d e d by t h e m e t e r 13 Per =(( Er - E ) / E ) *100; // p e r c e n t a g e e r r o r 14 disp ( Per , ” p e r c e n t a g e e r r o r i s ( f a s t ) ” )

8 9 10 11

Scilab code Exa 1.73 percentage error 1 2 3 4 5 6 7 8 9 10 11 12 13 14

// Example 1 . 7 3 / / p e r c e n t a g e e r r o r clc ; clear ; I =4.5; // c u r r e n t i n ampere V =230; // v o l t s pf =1; // power f a c t o r n =10; // no . o f r e v o l u t i o n s t =360; // t o t a l t i m e i n s e c o n d s nr =185; // n o r m a l d i s c no . o f r e v o l u t i o n s p e r kWh E =(( V * I * pf *190) /(3600*1000) ) ; // e n e r g y consumed i n 190 s e c o n d s i n kWh Er = n / nr ; // e n e r g y r e c o r d e d by t h e m e t e r Per =(( Er - E ) / E ) *100; // p e r c e n t a g e e r r o r disp ( - Per , ” p e r c e n t a g e e r r o r i s ( s l o w ) , (%)=” ) // a n s w e r i s c a l c u l a t e d wrong i n t h e t e x t b o o k b e c a u s e in c a l c u l a t i o n o f p e r c e n t a g e e r r o r i t i s not d i v i d e d by t h e a c t u a l v a l u e

Scilab code Exa 1.74 power 1 // Example 1 . 7 4 / / power 2 clc ;

57

3 clear ; 4 kwh1 =15000; // i n one kWh 5 n =150; // no . o f r e v o l u t i o n s i n 45 s e c o n d s 6 Pm = (1* n ) / kwh1 ; // power m e t e r e d on 150 r e v o l u t i o n s 7 P =( Pm *3600) /45; //POWER 8 disp ( P *1000 , ” power i n w a t t s i s ” )

Scilab code Exa 1.75 kWh registered by the meter and percentage error // Example 1 . 7 4 / / kWh & p e r c e n t a g e e r r o r clc ; clear ; I = (40*225) /600; // c u r r e n t i n a m p e r e s I1 =14; // c u r r e n t i n ampere V =230; // v o l t s pf =1; // power f a c t o r n =225; // no . o f r e v o l u t i o n s t =360; // t o t a l t i m e i n s e c o n d s E =(( V * I * pf *10) /(60*1000) ) ; // e n e r g y r e c o r d e d i n 1 h o u r i n kWh 11 Er =(( V * I1 * pf *10) /(60*1000) ) ; // e n e r g y consumed i n 1 h o u r i n kWh; / / e n e r g y r e c o r d e d by t h e m e t e r 12 Per =(( Er - E ) / E ) *100; // p e r c e n t a g e e r r o r 13 disp ( - Per , ” p e r c e n t a g e e r r o r i s ” )

1 2 3 4 5 6 7 8 9 10

58

Chapter 2 electronic instruments

Scilab code Exa 2.1 ammeter current 1 2 3 4 5 6 7 8 9 10 11 12 13 14

// Example 2 . 1 . // a m e t e r c u r r e n t clc ; clear ; close ; // g i v e n d a t a : Rq1 =100; // i n k i l o −ohm Rq2 = Rq1 ; Rq = Rq2 ; gm =0.005; // i n s i e m e n s Rm =50; // i n ohm Rd =10; // i n k i l o −ohm V1 =1; // i n v o l t s i =(( gm * Rq *10^2* Rd *10^2) /( Rq *10^2+ Rd *10^2) * V1 ) /(((2* Rd *10^2* Rq *10^2) /( Rd *10^2+ Rq *10^2) ) + Rm ) ; 15 disp ( i *10^3 , ” t h e ammeter c u r r e n t , i (mA) = ” )

Scilab code Exa 2.2 error 59

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

// Example 2 . 2 . // e r r o r clc ; clear ; close ; // g i v e n d a t a : m =150; T =3; Kf_sin =1.11; // Form f a c t o r o f s i n e wave // e =50∗ t Erms = sqrt (1/ T * integrate ( ’ ( 5 0 ∗ t ) ˆ2 ’ , ’ t ’ ,0 , T ) ) ; Eav =(1/ T * integrate ( ’ ( 5 0 ∗ t ) ’ , ’ t ’ ,0 , T ) ) ; kf = Erms / Eav ; R = Kf_sin / kf ; // r a t i o o f t h e two form f a c t o r s Pe =( R -1/1) *100; disp ( Pe , ” t h e p e r c e n t a g e e r r o r , Pe (%) = ” )

Scilab code Exa 2.3 error 1 2 3 4 5 6 7 8 9 10

// Example 2 . 3 . // e r r o r ‘ ‘ clc ; clear ; close ; // g i v e n d a t a : Kf_sin =1.11; // Form f a c t o r o f s i n e wave kf =1; // from i n t e r a t i o n Erms=Eav R = Kf_sin / kf ; // r a t i o o f t h e two form f a c t o r s Pe =( R -1/1) *100; disp ( Pe , ” t h e p e r c e n t a g e e r r o r , Pe (%) = ” )

Scilab code Exa 2.4 input voltage 1 2

// Example 2 . 4 . // i n p u t v o l t a g e ‘ ‘ 60

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

clc ; clear ; close ; // g i v e n d a t a : Va =2000; // i n v o l t s ld =0.02; // i n m d =.005; // i n m L =.3; // i n m D =.03; // i n m Og =100; // o v e r a l l g a i n Vd =(2* d * Va * D ) /( L * ld ) ; I = Vd / Og ; disp (I , ” i n o u t v o l t a g e , I (V) = ” )

Scilab code Exa 2.5 deflection voltage 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// Example 2 . 5 . // d e f l e c t i o n v o l t a g e and d e f l e c t i o n sensitivity ‘ clc ; clear ; close ; // g i v e n d a t a : Va =2500; // i n v o l t s ld =0.025; // i n m d =.005; // i n m L =.2; // i n m D =.03; // i n m Vd =(2* d * Va * D ) /( L * ld ) ; S =( D / Vd ) *1000; disp ( Vd , ” d e f l e c t i o n v o l t a g e , Vd (V) = ” ) disp (S , ” d e f l e c t i o n s e n s i t i v i t y , S (mm/V) = ” )

61

Scilab code Exa 2.6 deflection sensivity 1 2 3 4 5 6 7 8 9 10 11 12 13 14

// Example 2 . 6 // d e f l e c t i o n s e n s i t i v i t y clc ; clear ; close ; // g i v e n d a t a : Va =2500; // i n v o l t s ld =0.02; // i n m d =.005; // i n m L =.2; // i n m D =.03; // i n m Vd =(2* d * Va * D ) /( L * ld ) ; S =( D / Vd ) *1000; disp (S , ” d e f l e c t i o n s e n s i t i v i t y , S (mm/V) = ” )

Scilab code Exa 2.7 beam speed 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// Example 2 . 7 // t h e beem s p e e d and t h e d e f l e c t i o n sensitivity clc ; clear ; close ; // g i v e n d a t a : Va =2500; // i n v o l t s ld =.015; // i n m d =.005; // i n m L =.5; // i n m m =9.109*10^ -31; // i n kg e =1.602*10^ -19; v = sqrt ((2* e * Va ) / m ) ; S =(( L * ld ) /(2* d * Va ) ) *10^3; disp (v , ” t h e beem s p e e d , v (m/ s ) ” ) 62

16

disp (S , ” d e f l e c t i o n s e n s i t i v i t y , S (mm/V) = ” )

Scilab code Exa 2.8 density of the magnetic field 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// Example 2 . 8 // t h e d e n s i t y o f m a g n e t i c f i e l d clc ; clear ; close ; // g i v e n d a t a : Va =6000; // i n v o l t s l =.033; // i n m L =.22; // i n m D =0.044; // i n m m =9.109*10^ -31; // i n kg e =1.602*10^ -19; A = sqrt ( e /(2* m * Va ) ) ; C =( L * l * A ) ; B =( D / C ) *10^3; disp (B , ” t h e d e n s i t y m a g n e t i c f i e l d , B(mWb/mˆ 2 ) = ” )

Scilab code Exa 2.9 voltage 1 2 3 4 5 6 7 8 9 10 11

// Example 2 . 9 // v o l t a g e clc ; clear ; close ; // g i v e n d a t a : Va =800; // i n v o l t s B =1.8*10^ -4; // i n Wb/mˆ2 d =.01; // i n m m =9.109*10^ -31; // i n kg e =1.602*10^ -19; 63

12 13 14 15 16

A = sqrt ( e /(2* m * Va ) ) ; C=A*B; F =1/(2* d * Va ) ; Vd = C / F ; disp ( Vd , ” v o l t a g e , Vd (V) ” )

Scilab code Exa 2.10 peak to peak value amplitude and rms value of signal 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

// Example 2 . 1 0 // peak t o peak , a m p l i t u d e and rms value clc ; clear ; close ; // g i v e n d a t a : Va =3; // v e r t i c a l a t t e n u a t i o n i n mV/ d i v S =0.2; // 1 s u b d i v i s i o n // From t h e f i g u r e g i v e n i n q u e s t i o n : Div=1 u n i t & s u b d i v =0.2 u n i t Div =1; // u n i t subdiv =0.2; // u n i t Vpeak =2* Div +3* subdiv ; // o n l y f o r one peak Vpp = Vpeak *2; // For peak t o peak Vpp1 =( Va / Div ) * Vpp ; Vmax = Vpp1 /2; Vrms = Vmax / sqrt (2) ; disp ( Vpp1 , ” peak t o peak v a l u e , Vpp1 (mV) = ” ) disp ( Vmax , ” a m p l i t u d e , Vmax (mV) = ” ) disp ( Vrms , ”R .M. S v a l u e , Vrms (mV) = ” )

Scilab code Exa 2.11 phase angles 1

64

2 3 4 5 6 7 8 9 10

// Example 2 . 1 1 // d e t e r m i n e t h e p o s s i b l e p h a s e angles clc ; clear ; close ; // g i v e n d a t a : y1 =1.25; // d i v i s i o n y2 =2.5; // d i v i s i o n pi = asind ( y1 / y2 ) ; disp ( ” t h e p o s s i b l e a n g l e s , p i ( d e g r e e ) ” + string ( pi ) + ” o r ” + string (360 - pi ) + ” = ” )

Scilab code Exa 2.12 resistance 1 2 3 4 5 6 7 8 9 10 11

// Example 2 . 1 2 // c a l c u l a t e t h e unknown r e s i s t a n c e clc ; clear ; close ; // g i v e n d a t a : R1 =20; // i n k i l o −ohm R2 =30; // i n k i l o −ohm R3 =80; // i n k i l o −ohm Rx =( R2 * R3 ) / R1 ; disp ( Rx , ” t h e unknown r e s i s t a n c e , Rx ( k i l l o −ohm ) = ” )

Scilab code Exa 2.13 resistance 1 // Example 2 . 1 3 // c a l c u l a t e 2 clc ; 3 clear ; 4 close ; 5 // g i v e n d a t a :

65

t h e unknown r e s i s t a n c e

6 7 8 9 10 11 12 13 14 15 16

R1 =100.24; // i n ohm R2 =200; // i n ohm R3 =100.03; // i n micro −ohm l =100.31; // i n ohm m =200; // i n ohm Ry =680; // i n micro −ohm A =( R1 * R3 *10^ -6) / R2 ; B =( m * Ry *10^ -6) /( l + m + Ry *10^ -6) ; C =(( R1 / R2 ) -( l / m ) ) ; Rx =( A + B * C ) *10^6; disp ( Rx , ” t h e unknown r e s i s t a n c e , Rx ( micro −ohm ) = ” )

Scilab code Exa 2.14 constants of unknown arm 1 2 3 4 5 6 7 8 9 10 11 12

// Example 2 . 1 4 / / unknown r e s i s t a n c e clc ; clear ; Z1 =50 // i m p e d a n c e o f f i r s t arm ( i n ohm ) Za =80 // p h a s e a n g l e o f f i r s t arm ( i n d e g r e e ) Z2 =125 // i m p e d a n c e o f s e c o n d arm ( i n ohm ) Z3 =200 // impedane o f t h i r d arm ( i n ohm ) Zc =30 // p h a s e a n g l e o f t h i r d arm ( i n d e g r e e ) Z4 =( Z2 * Z3 ) / Z1 disp ( Z4 , ’ m a g n i t u d e o f Z4 arm ( i n ohm )= ’ ) Zd = Zc - Za disp ( Zd , ’ p h a s e a n g l e o f Z4 arm ( i n d e g r e e )= ’ )

Scilab code Exa 2.15 constants of arm CD 1 2 // Example 2 . 1 5 / / c a l c u l a t e 3 clc ; 4 clear ;

t h e c o n s t a n t s o f arm CD

66

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

f =1; // f r e q u e n c y i n kHz R1 =225; // i n ohms R2 =150; // i n ohms C2 =0.53; // c a p a c i t a n c e i n m i c r o f a r a d R3 =100; // i n ohms L =7.95; // i n mH oC2 =(2* %pi * f *10^3* C2 *10^ -6) ; // IN OHMS wL = (2* %pi * f *10^3* L *10^ -3) ; // i n ohms Z1 =225; // i n ohms Z2 = R2 -( %i *(1/ oC2 ) ) ; Z3 = R3 +( %i * wL ) ; // Z4 = ( Z2 * Z3 ) /( Z1 ) ; // unknow r e s i s t a n c e i n ohms R4 = real ( Z4 ) ; // C4 =1/(2* %pi * f *10^3* imag ( - Z4 ) ) ; // c a p a c i t a n c e i n f a r a d disp ( R4 , ” r e s i s t a n c e i n arm CD i n ohms ” ) disp ( C4 *10^6 , ” c a p a c i t a n c e i n m i c r o f a r a d s ” )

Scilab code Exa 2.16 resistance and capacitance 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

// Example 2 . 1 6 / / r e s i s t a n c e and c a p a c i t a n c e clc ; clear ; w =7500; // i n r a d / s R2 =140; // i n ohms R3 =1000; // i n ohms R4 = R3 ; // i n ohms C2 =0.0115; // c a p a c i t a n c e i n m i c r o f a r a d oC2 =( w * C2 *10^ -6) ; // IN OHMS Z2 = R2 +( %i *(1/ oC2 ) ) ; Z3 = R3 ; // Z4 = R4 ; // Z1 =( Z2 * Z3 ) /( Z4 ) ; // R1 = real ( Z1 ) ; // C1 =1/( w * imag ( Z1 ) ) ; // c a p a c i t a n c e i n f a r a d 67

17 18

disp ( R1 , ” r e s i s t a n c e i n arm CD i n ohms ” ) disp ( C1 *10^6 , ” c a p a c i t a n c e i n arm CD i n m i c r o f a r a d s ” )

Scilab code Exa 2.17 series euivalent of unknown impedence 1 2 3 4 5 6 7 8 9 10 11

// Example 2 . 1 7 / / s e r i e s e q u i v a l e n t o f unknown impedence clc ; clear ; R1 =235; // i n k i l l o ohms C1 =0.012; // c a p a c i t a n c e i n m i c r o f a r a d s R2 =2.5; // i n k i l l o ohms R3 =50; // i n k i l o ohms Rx =( R2 * R3 ) /( R1 ) ; // i n k i l l o ohms Lx = C1 *10^ -6* R2 * R3 *10^6; // i n h e n r y disp ( Rx , ” unknown r e s i s t a n c e i n k i l l o ohms ” ) disp ( Lx , ” i n d u c t a n c e i n h e n r y ” )

Scilab code Exa 2.18 series euivalent of unknown inductance and resistance 1 2 3 4 5 6 7 8 9

// Example 2 . 1 8 / / s e r i e s e q u i v a l e n t o f unknown impedence clc ; clear ; w =3000; // i n r a d / s R1 =1.8; // i n k i l l o ohms C1 =0.9; // c a p a c i t a n c e i n m i c r o f a r a d s R2 =9; // i n k i l l o ohms R3 =0.9; // i n k i l o ohms 68

10 Rx = (( w ^2*( C1 *10^ -6) ^2* R1 *10^3* R2 *10^3* R3 *10^3) /(1+ w

^2*( R1 *10^3) ^2*( C1 *10^ -6) ^2) ) ; // 11 Lx =(( R2 *10^3* R3 *10^3* C1 *10^ -6) /(1+ w ^2*( R1 *10^3) ^2*( 12 13 14

C1 *10^ -6) ^2) ) ; // i n h e n r y disp ( Rx *10^ -3 , ” unknown r e s i s t a n c e i n k i l l o ohms ” ) disp ( Lx , ” i n d u c t a n c e i n h e n r y ” ) // a n s w e r i s wrong i n t h e t e x t b o o k

Scilab code Exa 2.19 resistance capacitance and dissioation factor 1 2 3 4 5 6 7 8 9 10 11 12 13 14

// Example 2 . 1 9 / / unknown r e s i s t a n c e , c a p a c i t a n c e and dissipation factor clc ; clear ; f =1; // f r e q u e n c y i n kHz R1 =1.5; // i n k i l l o ohms C1 =0.4; // i n m i c r o f a r a d s R2 =3; // i n k i l l o ohms C3 =0.4; // i n m i c r o f a r a d s Rx =( R2 * C1 ) /( C3 ) ; // unknown r e s i s t a n c e i n k i l l o ohms Cx =( R1 * C3 ) /( R2 ) ; //UNKNOWN CAPACITANCE IN MICRO FARADS D = 2* %pi * f * Cx *10^ -6* Rx *10^3*10^3; // DISSIPATION FACTPR disp ( Rx , ” unknown r e s i s t a n c e i n k i l l o ohms ” ) disp ( Cx , ” unknown c a p a c i t a n c e i n m i c r o f a r a d s ” ) disp (D , ” d i s s i p a t i o n f a c t o r i s ” )

Scilab code Exa 2.20 equivalent parralel resistance and capacitance 1 // Example 2 . 2 0 / / unknown r e s i s t a n c e 2 clc ; 3 clear ;

69

, capacitance

f =2; // f r e q u e n c y i n kHz R1 =2.8; // i n k i l l o ohms C1 =4.8; // i n m i c r o f a r a d s R2 =20; // i n k i l l o ohms R4 =80; // i n k i l l o ohms R3 =(( R4 / R2 ) *( R1 *10^3+(1/((2* %pi * f *10^3) ^2*( C1 *10^ -6) ^2* R1 *10^3) ) ) ) ; // 10 C3 =(1/((2* %pi * f *10^3) ^2* C1 *10^ -6* R1 *10^3* R3 ) ) ; // capaciatnce 11 disp ( R3 *10^ -3 , ” unknown r e s i s t a n c e i n k i l l o ohms ” ) 12 disp ( C3 *10^12 , ”CAPACITANCE IN PICO FARAD I S ” ) 4 5 6 7 8 9

Scilab code Exa 2.21 resistance and capacitance 1 2 3 4 5 6 7 8 9 10

// Example 2 . 2 1 / / RESISTANCE AND INDUCTANCE clc ; clear ; L1 =52.6; // i n mH R2 =1.68; // i n ohms r1 =28.5; // i n t e r n a l r e s i s t a n c e i n ohms r2 = r1 - R2 ; // r e s i s t a n c e i n ohms L2 = L1 ; // i n d u c t a n c e i n mH disp ( r2 , ” r e s i s t a n c e i n ohms ” ) disp ( L2 , ” i n d u c t a n c e i n mH” )

Scilab code Exa 2.22 constants of arm CD 1 2 // Example 2 . 2 2 / / c a l c u l a t e 3 clc ; 4 clear ; 5 f =1; // f r e q u e n c y i n kHz 6 C1 =0.2; // i n m i c r o f a r a d

t h e c o n s t a n t s o f arm CD

70

7 8 9 10 11 12 13 14 15 16 17

R2 =500; // i n ohms R3 =300; // i n ohms C3 =0.1; // i n m i c r o f r a d s Z1 =0 - %i *(1/(2* %pi * f *10^3* C1 *10^ -6) ) ; // Z2 = R2 ; // Y3 = ((1/ R3 ) +( %i *2* %pi * f *10^3* C3 *10^ -6) ) ; // Z4 =( Z2 ) /( Z1 * Y3 ) ; // Rx = real ( Z4 ) ; // Lx =( imag ( Z4 ) ) /(2* %pi * f ) ; // disp ( Rx , ” unknown r e s i s t a n c e i n ohms ” ) disp ( round ( Lx ) ,” unknow c a p a c i t a n c e i n mH” )

Scilab code Exa 2.23 constant of Zx 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

// Example 2 . 2 3 / / c a l c u l a t e t h e c o n s t a n t s zX clc ; clear ; R1 =200; // IN OHMS f =1; // f r e q u e n c y i n kHz C2 =5; // i n m i c r o f a r a d R2 =200; // i n ohms R3 =500; // i n ohms C3 =0.2; // i n m i c r o f r a d s Z1 = R1 ; // Z2 = R2 -( %i *(1/(2* %pi * f *10^3* C2 *10^ -6) ) ) ; // Z3 = R3 -( %i *(1/(2* %pi * f *10^3* C3 *10^ -6) ) ) ; // Zx =( Z2 * Z3 ) / Z1 ; Rx = real ( Zx ) ; Cx =((1/(2* %pi * f *10^3* imag ( - Zx ) ) ) ) ; // disp ( Rx , ” unknown r e s i s t a n c e i n ohms ” ) disp ( Cx *10^6 , ” unknown c a p a c i t a n c e i n m i c r o f a r a d s ” )

71

Scilab code Exa 2.24 resistance and inductance 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

// Example 2 . 2 4 / / f i n d unknow r e s i s t a n c e and inductance clc ; clear ; R1 =600; // i n ohms f =1; // f r e q u e n c y i n kHz C1 =1; // i n m i c r o f a r a d R2 =100; // i n ohms R3 =1000; // i n ohms Y1 =((1/ R1 ) +( %i *2* %pi * f *10^3* C1 *10^ -6) ) ; // Z2 = R2 ; // Z3 = R3 ; // Z4 = Z2 * Z3 * Y1 ; // Rx = real ( Z4 ) ; // Lx =( imag ( Z4 ) ) /(2* %pi * f ) ; // disp ( round ( Rx ) ,” unknown r e s i s t a n c e i n ohms ” ) disp ( Lx *10^ -3 , ” unknow c a p a c i t a n c e i n Henry ” )

Scilab code Exa 2.25 capacitance power factor and relative permittivity 1 2 3 4 5 6 7 8 9 10 11

// Example 2 . 2 5 / / c a p a c i t a n c e , power f a c t o r and relative permittivity clc ; clear ; f =50; // i n h e r t z C2 =106; // c a p a c i t a n c e i n p i c o f a r a d R4 =(1000/ %pi ) ; // IN OHMS C4 =0.055; // i n m i c r o f a r a d s R3 =270; // i n ohms R1 = ( R3 * C4 *10^ -6) /( C2 *10^ -12) ; // IN OHMS C1 =( R4 * C2 *10^ -12) /( R3 ) ; // i n f a r a d s pf =2* %pi * f * R1 * C1 *10^ -12; // 72

12 13 14 15 16 17 18

Eo =8.854*10^ -12; // a = ( %pi *12^2) /(4*100^2) ; // i n m e t e r s q u a r e t =0.005; //THICKNESS IN METER Er = (( C1 * t ) /( Eo * a ) ) ; // r e l a t i v e p e r m i t t i v i t y disp ( C1 *10^12 , ” c a p a c i t a n c e i n p i c o f a r a d ” ) disp ( pf *10^13 , ” power f a c t o r i s ” ) disp ( Er , ” r e a l t i v e p e r m i t t i v i t y i s ” )

Scilab code Exa 2.26 distributed capacitance 1 2 3 4 5 6 7 8 9

// Example 2 . 2 6 // s e l f c a p a c i t a n c e clc ; clear ; close ; // g i v e n d a t a : C1 =420; // i n p i c o −f a r a d C2 =90; // i n p i c o −f a r a d Cd =( C1 -4* C2 ) /3; disp ( Cd , ” t h e s e l f c a p a c i t a n c e , Cd ( p i c o −f a r a d ) = ” )

Scilab code Exa 2.27 distributed capacitance 1 2 3 4 5 6 7 8 9 10 11

// Example 2 . 2 7 // d i s t r i b u t e d c a p a c i t a n c e clc ; clear ; close ; // g i v e n d a t a : C1 =410; // i n p i c o −f a r a d C2 =50; // i n p i c o −f a r a d f1 =2; // i n MHz f2 =5; // i n MHz F = f2 / f1 ; Cd =( C1 - F ^2* C2 ) /5.25; 73

12

disp ( Cd , ” t h e s e l f c a p a c i t a n c e , Cd ( p i c o −f a r a d ) = ” )

Scilab code Exa 2.28 resistive and reactive components of unknow impedence 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// Example 2 . 2 8 // r e s i s t i v e and r e a c t i v e component clc ; clear ; close ; // g i v e n d a t a : C1 =190*10^ -12; // i n f a r a d C2 =170*10^ -12; // i n f a r a d Q1 =75; Q2 =45; f =200; // i n k i l o −Hz w =2* %pi * f *1000; Rx =(( C1 * Q1 ) -( C2 * Q2 ) ) /( w * C1 * C2 * Q1 * Q2 ) ; Xx =( C1 - C2 ) /( w * C1 * C2 ) ; disp ( Rx , ” t h e r e s i s t i v e , Rx ( ohm ) = ” ) disp ( Xx , ” t h e r e a c t i v e component , Xx ( ohm ) = ” )

Scilab code Exa 2.29 percentage error 1 2 3 4 5 6 7 8 9 10

// Example 2 . 2 9 // p e r c e n t a g e e r r o r clc ; clear ; close ; // g i v e n d a t a : R =4; // i n ohm f =500; // i n k i l o −Hz C =120; // i n p i c o −f a r a d O =0.02; // i n ohm w =2* %pi * f *10^3; 74

11 Qt =1/( w * C *10^ -12* R ) ; 12 Qi =1/( w * C *10^ -12*( R + O ) ) ; 13 Pe =(( Qt - Qi ) / Qt ) *100; 14 disp ( Pe , ” t h e p e r c e n t a g e e r r o r , Pe (%) = ” )

Scilab code Exa 2.30 self capacitance 1 2 3 4 5 6 7 8 9 10

// Example 2 . 3 0 // s e l f c a p a c i t a n c e clc ; clear ; close ; // g i v e n d a t a : C1 =100; // i n p i c o −f a r a d f1 =600; // i n k i l o −Hz f2 =2; // i n M−Hz Cd =( f1 *1000) ^2* C1 /(( f2 *10^6) ^2 -( f1 *1000) ^2) disp ( Cd , ” t h e s e l f c a p a c i t a n c e , Cd ( p i c o −f a r a d ) = ” )

Scilab code Exa 2.31 resistance and inductance 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 2 . 3 1 // i n d u c t a n c e and r e s i s t a n c e clc ; clear ; close ; // g i v e n d a t a : C =220; // i n p i c o −f a r a d f1 =400; // i n k i l o −Hz Rsh =0.8; // i n ohm Q =110; w =2* %pi * f1 *1000; L =(1/( w ^2* C *10^ -12) ) ; R =(( w * L ) / Q ) ; 75

14 15

disp ( L *10^6 , ” i n d u c t a n c e , L ( micro −H) = ” ) disp (R , ” r e s i s t a n c e , R( ohm ) = ” )

Scilab code Exa 2.32 inductance and capacitance 1 2 3 4 5 6 7 8 9 10 11 12

// Example 2 . 3 2 // i n d u c t a n c e and c a p a c i t a n c e clc ; clear ; close ; // g i v e n d a t a : f =2*10^6; // r e s o n a n t f r e q e n c i e s i n Hz Cs =210*10^ -12; // r e s o n a n t c a p a c i t o r i n f a r a d Cv =6*10^ -12; // c a p a c i t a n c e o f v o l t m e t e r i n f a r a d L =1/(( Cs + Cv ) *4^2*( %pi ) ^2* f ^2) ; C =((1/(4* L *( %pi ) ^2* f ^2*10^ -12) ) -6) ; // disp ( L *10^6 , ” i n d u c t a n c e , L ( m i c r o h e n r y ) = ” ) disp (C , ” c a p a c i t a n c e i n pF i s ” )

Scilab code Exa 2.33 inductance and resistance 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 2 . 3 3 // i n d u c t a n c e and r e s i s t a n c e clc ; clear ; close ; // g i v e n d a t a : C1 =40; // i n p i c o −f a r a d C2 =48; // i n p i c o −f a r a d f =4; // i n MHz R1 =60; // a d d i t i o n a l s e r i e s r e s i s t a n c e i n ohm C0 =( C1 + C2 ) /2; w =2* %pi * f *10^6; L =(1/(4* %pi ^2*( f *10^6) ^2*( C0 *10^ -6) ) ) ; // X = (( w * L *10^6) -(1/( w * C2 *10^ -12) ) ) ^2; // 76

14 R = (X - R1 ^2) /120; // unknown r e s i s t a n c e i n ohms 15 disp ( L *10^12 , ” i n d u c t a n c e i n MH” ) 16 disp (R , ” unknown r e s i s t a n c e i n ohms ” ) 17 // r e s i s t a n c e i s c a l c u l a t e d wrong i n t h e t e x t b b o k

Scilab code Exa 2.34 Q factor and effective resistance 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// Example 2 . 3 1 // i n d u c t a n c e and r e s i s t a n c e clc ; clear ; close ; // g i v e n d a t a : fo =1.2*10^6; // i n Hz C =160*10^ -12; // i n f a r a d f =6*10^3; // r e s o n a n t f r e q u e n c y i n Hz f1 = fo + f ; f2 = fo - f ; F = f1 - f2 ; Q = fo / F ; R = F /((2* %pi *( fo ) ^2* C ) ) ; disp (Q , ”Q f a c t o r , Q = ” ) disp (R , ” r e s i s t a n c e , R( ohm ) = ” )

Scilab code Exa 2.35 self capacitance and inductance 1 2 3 4 5 6 7 8

// Example 2 . 3 5 // s e l f c a p a c i t a n c e and i n d u c t a n c e clc ; clear ; close ; C1 =200; // i n p i c o f a r a d s f1 =(2/ %pi ) *10^6; // i n h e r t z C2 =40; // i n p i c o f a r d s f2 =2* f1 ; // 77

9 CD = (( f1 ^2* C1 *10^ -12) -( f2 ^2* C2 *10^ -12) ) /( f2 ^2 - f1 ^2) ;

// 10 L =1/(4^2*( C1 + CD *10^12) ) ; // 11 disp ( CD *10^12 , ” c a p a c i t a n c e i n p i c o f a r a d ” ) 12 disp ( L *10^6 , ” i n d u c t a n c e i n m i c r o h e n r y ” )

78

Chapter 5 Digital Instruments

Scilab code Exa 5.1 frequency of the system 1 2 3 4 5 6 7 8 9

// Example 5 . 1 // f r e q u e n c y clc ; clear ; close ; // g i v e n d a t a : N =45; // c o u n t t =10; // g a t e p e r i o d i n ms f =( N /( t *10^ -3) ) *10^ -3; disp (f , ” f r e q u e n c y , f ( k−Hz ) = ” )

Scilab code Exa 5.2 possible error 1 // Example 5 . 2 // p o s s i b l e 2 clc ; 3 clear ; 4 close ; 5 // g i v e n d a t a : 6 n =3;

error

79

7 8 9 10 11 12 13 14

R =1/10^ n ; v =2; // i n v r =0.5/100; R1 =1* R ; // f u l l s c a l e r a n g e o f 1 V R2 =10* R ; // f u l l s c a l e r a n g e o f 10 V Lsd =5* R ; Pe =( r * v ) + Lsd ; disp ( Pe , ” t h e p o s s i b l e e r r o r , Pe (V) = ” )

Scilab code Exa 5.3 resolution 1 // Example 5 . 3 // r e s o l u t i o n 2 clc ; 3 clear ; 4 close ; 5 // g i v e n d a t a : 6 n =4; 7 R =1/10^ n ; 8 disp (R , ” r e s o l u t i o n , R = ” )

80

Chapter 6 instrument transformers

Scilab code Exa 6.1 actual transformation ratio phase angle and maximum flux density 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

// Example 6 . 1 / / a c t u a l t r a n s f o r m e r r a t i o , p h a s e a n g l e and maximum f l u x d e n s i t y clc ; clear ; Np =1; // no . o f p r i m a r y t u r n s Ns =240; // no . o f s e c o n d a r y t u r n s Is =5; //SECONDARY WINDING CURRENT IN AMPERE Re =1.2; // e x t e r n a l b u r d e n i n ohms mmf =96; // m a g n e r o m o t i v e f o r c e i n AT Ac =1200; //CROSS SECTIONAL AREA IN MM s q a u r e f =50; // s u p l l y f r e q u e n c y i n h e r t z Kt = Ns / Np ; // t u r n r a t i o Es = Is * Re ; // v o l t a g e i n d u c e d i n s e c o n d a r y w i n d i n g Im = mmf / Np ; // m a g n e t i s i n g component o f c u r r e n t i n ampere Rs = Kt * Is ; // r e f l e c t e d s e c o n d a r y w i n d i n g c u r r e n t i n ampere Ip = sqrt ( Rs ^2+ Im ^2) ; // p r i m a r y c u r r e n t i n ampere Kact = Ip / Is ; // a c t u a l t u r n r a t i o Theta = atand ( Im /( Kt * Is ) ) ; // 81

18 Phm = (( Es /(4.44* f * Ns ) ) ) ; // f l u x i n Wb 19 Bm = Phm /( Ac *10^ -6) ; //maximum f l u x d e n s i t y i n Wb/ 20 21 22 23

Meter s q u r e temp = Theta - floor ( Theta ) disp ( Kact , ” a c t u a l t r a n s f o r m a t i o n r a t i o i s ” ) disp ( ” t h e p h a s e a n g l e i s ” + string ( floor ( Theta ) ) + ” d e g r e e and ” + string ( round ( temp *60) ) + ” min ” ) ; disp ( Bm , ”maximum f l u x d e n s i t y i n Wb/ m e t e r s q u a r e ” )

Scilab code Exa 6.2 ratio error and phase angle 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

// Example 6 . 2 / / r a t i o e r r o r and p h a s e a n g l e clc ; clear ; dv =0; // a s s e c o n d a r y w i n d i n g power f a c t o r i s u n i t y Io =1; // i n ampere Knom =200; // n o m i n a l r a t i o Re =1.1; // e x t e r n a l b u r d e n i n ohms Pf =0.45; // power f a c t o r d = acosd ( Pf ) ; // alpha =90 - d ; // i n d e g r e e s Is =5; // i n ampere Rs = Knom * Is ; // Kact = Knom +(( Io / Is ) * sind ( dv + alpha ) ) ; // a c t u a l transformation ratio Re = (( Knom - Kact ) / Kact ) *100; // r a t i o e r r o r i n percentage pa =((180/ %pi ) *( Io * cosd ( dv + alpha ) ) / Rs ) ; // p h a s e a n g l e in degree pa1 = pa - round ( pa ) ; pa2 = pa *3600; // pa3 = round ( pa2 ) ; pa4 = pa3 -180; // pa5 = pa2 - pa4 ; // disp ( Re , ” r a t i o e r r o r i n p e r c e n t a g e i s ” ) 82

22

disp ( ” t h e p h a s e a n g l e i s ” + string ( round ( pa5 /60) ) + ” min and ” + string ( pa4 ) + ” s e c o n d s ” ) ;

Scilab code Exa 6.3 flux and ratio error 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

// Example 6 . 3 / / a f l u x , r a t i o e r r o r clc ; clear ; f =50; // f r e q u e n c y i n h e r t z Np =1; // no . o f p r i m a r y t u r n s Il =1.4; // i r o n l o s s i n w a t t s Is =5; //SECONDARY WINDING CURRENT IN AMPERE Re =1.4; // e x t e r n a l b u r d e n i n ohms mmf =80; // m a g n e r o m o t i v e f o r c e i n AT Kt =200; // t u r n r a t i o Ns = Kt * Np ; // no . o f s e c o n d a r y t u r n s Es = Is * Il ; // v o l t a g e i n d u c e d i n s e c o n d a r y w i n d i n g Ep = Es / Kt ; // p r i m a r y v o l t a g e Iw = Il / Ep ; // l o s s component i n ampere Im = mmf / Np ; // m a g n e t i s i n g component o f c u r r e n t i n ampere Kact = Kt +(( Iw / Is ) ) ; // a c t u a l r a t i o Re = (( Kt - Kact ) / Kact ) *100; // r a t i o e r r o r i n p e r c e n t a g e Phm = (( Es /(4.44* f * Ns ) ) ) ; // f l u x i n Wb disp ( Phm , ”maximum f l u x d e n s i t y i n Wb” ) disp ( Re , ” r a t i o e r r o r i n p e r c e n t a g e i s ” )

Scilab code Exa 6.4 ratio error and phase angle error 1 // Example 6 . 4 / / r a t i o e r r o r and p h a s e a n g l e 2 clc ; 3 clear ; 4 Ns =250; // no . o f s e c o n d a r y t u r n s

83

error

Rp =1.4; // i n ohms f =50; // f r e q u e n c y i n h e r t z Np =1; // no . o f p r i m a r y t u r n s Is =5; //SECONDARY WINDING CURRENT IN AMPERE Re =1.1; // e x t e r n a l b u r d e n i n ohms mmf =80; // m a g n e r o m o t i v e f o r c e i n AT Il =1.1; //IRON LOSS IN WATTS Kt = Ns / Np ; // t u r n r a t i o Se = sqrt ( Rp ^2+ Re ^2) ; // s e c o m d a r y c i r c u i t i m p e d a n c e i n ohms 14 csd = Rp / Se ; // c o s a n g l e 15 sd = Il / Se ; // SIN ANGLE 5 6 7 8 9 10 11 12 13

16 17 18 19 20 21 22 23 24 25

Es = Is * Se ; // v o l t a g e i n d u c e d i n s e c o n d a r y w i n d i n g Ep = Es / Kt ; // p r i m a r y v o l t a g e Iw = Il / Ep ; // l o s s component i n ampere Im = mmf / Np ; // m a g n e t i s i n g component o f c u r r e n t i n ampere Kact = Kt +(( Im * sd ) +( Iw * csd ) ) / Is ; // a c t u a l r a t i o Re = (( Kt - Kact ) / Kact ) *100; // r a t i o e r r o r i n p e r c e n t a g e Pa =((180/ %pi ) *( Im * csd - Iw * sd ) /( Kt * Is ) ) ; // p h a s e a n g l e in degree disp ( Re , ” r a t i o e r r o r i n p e r c e n t a g e i s ” ) disp ( Pa , ” p h a s e a n g l e i n d e g r e e i s ” )

Scilab code Exa 6.5 primary winding current actual transformation ration and number of turns 1 2 3 4 5 6

// Example 6 . 5 / / p r i m a r y w i n d i n g c u r r e n t , a c t u a l t r a n s f o r m a t i o n r a t i o and no . o f t u r n s clc ; clear ; Ns =300; // no . o f s e c o n d a r y t u r n s Xe =0.55; // i n ohms Xs =0.25; // i n ohms 84

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

f =50; // f r e q u e n c y i n h e r t z Np =1; // no . o f p r i m a r y t u r n s Is =5; //SECONDARY WINDING CURRENT IN AMPERE Re =1.0; // e x t e r n a l b u r d e n i n ohms Rs =0.3; // i n ohms mmf =90; // m a g n e r o m o t i v e f o r c e i n AT mmfc =45; //mmf f o r c o r e l o s s i n AT ts = Rs + Re ; // t o t a l s e c o n d a r y c i r c u i t r e s i s t a n c e tr = Xe + Xs ; // t o t a l s e c o n d a r y c i r c u i t r e a c t a n c e d = atand ( tr / ts ) ; // s e c o n d a d y p h a s e a n g l e i n d e g r e e csd = cosd ( d ) ; sd = sind ( d ) ; Kt =300; // Iw = mmfc / Np ; // l o s s component i n ampere Im = mmf / Np ; // m a g n e t i s i n g component o f c u r r e n t i n ampere Kact = Kt +(( Im * sd ) +( Iw * csd ) ) / Is ; // a c t u a l r a t i o Ip = Kact * Is ; // p r i m a r y c u r r e n t i n a m p e r e s Knom =300; //NOMINAL TRANSFORMATION RATIO Ktd = Knom -(( Im * sd ) +( Iw * csd ) ) / Is ; // f o r z e r o r a t i o error Nsd = Ktd * Np Rtr = round ( Knom - Nsd ) ; // r e d u c t i o n i n s e c o n d a r y w i n d i n g turns disp ( Ip , ” p r i m a r y c u r r e n t i n ampere ” ) disp ( Kact , ” a c t u a l t r a n s f o r m a t i o n r a t i o ” ) disp ( Rtr , ” r e d u c t i o n i n s e c o n d a r y w i n d i n g t u r n s ” )

Scilab code Exa 6.6 actual ratio and phase angle 1 // Example 6 . 6 / / a c t u a l r a t i o and p h a s e a n g l e 2 clc ; 3 clear ; 4 Ns =100; // no . o f s e c o n d a r y t u r n s 5 f =50; // f r e q u e n c y i n h e r t z

85

Np =1; // no . o f p r i m a r y t u r n s Knom =100 Io =1.8; // a m p e r e s Is =1; //SECONDARY WINDING CURRENT IN AMPERE Re =1.45; // e x t e r n a l b u r d e n i n ohms Rs =0.25; // i n ohms La =38.4; // l a g g i n g a n g l e i n d e g r e e Kt = Ns / Np ; // a c t u a l r a t i o ts = Rs + Re ; // t o t a l s e c o n d a r y c i r c u i t r e s i s t a n c e alpha =90 - La ; // PHASE ANGLE Kact = Kt +(( Io / Is ) * sind ( alpha ) ) ; // a c t u a l transformation ratio 17 Pa =((180/ %pi ) *( Io * cosd ( alpha ) ) /( Kt * Is ) ) ; // p h a s e angle in degree 18 disp ( Pa , ” p h a s e a n g l e i n d e g r e e i s ” ) 19 disp ( Kact , ” a c t u a l t r a n s f o r m a t i o n r a t i o ” )

6 7 8 9 10 11 12 13 14 15 16

Scilab code Exa 6.7 actual ratio and phase angle error 1 2 3 4 5 6 7 8 9 10 11 12 13 14

// Example 6 . 7 / / r a t i o clc ; clear ; Is =5; // i n a m p e r e s Ns =200; // no . o f s e c o n d a r y t u r n s f =50; // f r e q u e n c y i n h e r t z Np =1; // no . o f p r i m a r y t u r n s Iw =5; // i n a m p e r e s Im =8; // a m p e r s s Kt = Ns / Np ; // t u r n r a t i o csd1 =0.8; // sd1 = sqrt (1 - csd1 ^2) ; // Kact1 = Kt +(( Im * sd1 ) +( Iw * csd1 ) ) / Is ; // a c t u a l r a t i o when 0 . 8 p . f . l a g g i n g 15 Re1 = (( Kt - Kact1 ) / Kact1 ) *100; // r a t i o e r r o r i n 86

16 17 18 19 20 21 22 23 24 25 26 27

p e r c e n t a g e when 0 . 8 p . f . l a g g i n g Pa1 =((180/ %pi ) *( Im * csd1 - Iw * sd1 ) ) /( Kt * Is ) ; // p h a s e a n g l e i n d e g r e e when 0 . 8 p f l a g g i n g csd2 =0.8; // sd2 = -0.6; // Kact2 = Kt +(( Im * sd2 ) +( Iw * csd2 ) ) / Is ; // a c t u a l r a t i o when 0 . 8 p . f . l e a d i n g Re2 = (( Kt - Kact2 ) / Kact2 ) *100; // r a t i o e r r o r i n p e r c e n t a g e when 0 . 8 p . f . l e a d i n g Pa2 =((180/ %pi ) *( Im * csd2 - Iw * sd2 ) ) /( Kt * Is ) ; // p h a s e a n g l e i n d e g r e e when 0 . 8 p f l e a d i n g disp ( Kact1 , ” a c t u a l r a t i o when 0 . 8 p . f . l a g g i n g ” ) disp ( Re1 , ” p e r c e n t a g e r a t i o e r r o r when 0 . 8 p . f . l a g g i n g ”) disp ( Pa1 , ” p h a s e a n g l e when 0 . 8 p . f . l a g g i n g i n degree ”) disp ( Kact2 , ” a c t u a l r a t i o when 0 . 8 p . f . l e a d i n g ” ) disp ( Re2 , ” p e r c e n t a g e r a t i o e r r o r when 0 . 8 p . f . l e a d i n g ”) disp ( Pa2 , ” p h a s e a n g l e when 0 . 8 p . f . l e a d i n g i n degree ”)

Scilab code Exa 6.8 current nd phase angle error 1 2 3 4 5 6 7 8 9 10 11

// Example 6 . 8 / / c u r r e n t and p h a s e a n g l e e r r o r s clc ; clear ; Ns =99; // no . o f s e c o n d a r y t u r n s Xe =0.55; // i n ohms Xs =0.35; // i n ohms f =50; // f r e q u e n c y i n h e r t z Np =1; // no . o f p r i m a r y t u r n s Is =5; //SECONDARY WINDING CURRENT IN AMPERE Rs =0.4; // i n ohms Re = (20) /( Is ^2) ; // innohms 87

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

Xe =0; // mmf =6; // m a g n e r o m o t i v e f o r c e i n AT mmfc =8; //mmf f o r c o r e l o s s i n AT ts = Rs + Re ; // t o t a l s e c o n d a r y c i r c u i t r e s i s t a n c e tr = Xe + Xs ; // t o t a l s e c o n d a r y c i r c u i t r e a c t a n c e d = atand ( tr / ts ) ; // s e c o n d a d y p h a s e a n g l e i n d e g r e e csd = cosd ( d ) ; sd = sind ( d ) ; Kt =99; // Knom =100 Iw = mmfc / Np ; // l o s s component i n ampere Im = mmf / Np ; // m a g n e t i s i n g component o f c u r r e n t i n ampere Kact = Kt +(( Im * sd ) +( Iw * csd ) ) / Is ; // a c t u a l r a t i o Re =(( Knom - Kact ) / Kact ) *100; // c u r r e n t e r r o r i n percentage Pa =((180/ %pi ) *( Im * csd - Iw * sd ) ) /( Kt * Is ) ; // p h a s e e r r o r disp ( Re , ” c u r r e n t e r r o r i n p e r c e n t a g e i s ” ) disp ( Pa , ” p h a s e e r r o r i n d e g r e e i s ” )

Scilab code Exa 6.9 ratio error and phase angle 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 6 . 9 / / c u r r e n t and p h a s e a n g l e e r r o r s clc ; clear ; Is =5; // IN AMPERES Ip =100; // p r i m a r y c u r r e n t i n a m p e r e s VA =20; //BURDEN xr =4; // mmfc =0.18; //mmf f o r c o r e l o s s i n AT Ep = VA / Ip ; // v o l t a g e a c r o s s p r i m a r y w i n d i n g d = atand (1/ xr ) ; // s e c o n d a d y p h a s e a n g l e i n d e g r e e csd = cosd ( d ) ; sd = sind ( d ) ; Kt =20; // 88

14 Knom =20 15 Iw = mmfc / Ep ; // l o s s component i n ampere 16 Im = 1.4; // m a g n e t i s i n g component o f c u r r e n t i n ampere 17 Kact = Kt +(( Im * sd ) +( Iw * csd ) ) / Is ; // a c t u a l r a t i o 18 Re =(( Knom - Kact ) / Kact ) *100; // c u r r e n t e r r o r i n 19 20 21 22

percentage Pa =((180/ %pi ) *( Im * csd - Iw * sd ) ) /( Kt * Is ) ; // p h a s e e r r o r disp ( Re , ” c u r r e n t e r r o r i n p e r c e n t a g e i s ” ) disp ( Pa , ” p h a s e e r r o r i n d e g r e e i s ” ) // a n s w e r i s wrong i n t h e book

Scilab code Exa 6.10 phase angle error and burden in VA 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

// Example 6 . 1 0 / / p h a s e e r r o r s and b u r d e n clc ; clear ; Vs =100; // IN VOLTS Kt =10; //TRANSFORMATION RATIO Rp =86.4; // p r i m r y r e s i s t a n c e IN OHMS Xp =62.5; // p r i m a r y r e a c t a n c e i n ohms Rs =0/78; // s e c o n d a r y r e s i s t a n c e i n ohms Xe =102; // r e a c t a n c e i n ohms Io =0.03; // i n a m p e r e s pf =0.42 csd1 =0.42; // sd = sqrt (1 - csd1 ^2) ; // Iw = Io * csd1 ; // i n a m p e r e s Im = Io * sd ; // i n a m p e r e s pa = (( Iw * Xp ) -( Im * Rp ) ) /( Kt * Vs ) ; // p h a s e a n g l e i n r a d i a n s AT NO LOAD csd2 =1; //AT BURDEN sd2 =0; // Is = 1.5632/10.2; // i n a m p e r e s B = Vs * Is ; //BURDEM IN VA 89

22 23 24

disp ( pa , ” p h a s e a n g l e i n r a d i a n s a t no l o a d ” ) // p h a s e a n g l e i s c a l u l a t e d wrong i n t h e t e x t b o o k disp (B , ” b u r d e n i n VA i s ” )

Scilab code Exa 6.11 ratio and phase angle error 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

// Example 6 . 1 1 / / r a t i o and p h a s e e r r o r s clc ; clear ; Kt =60.476; //TRANSFORMATION RATIO Knom = Kt ; // Vs =63; // i n v o l t s Rs =2; // i n ohms Xs =1; // IN OHMS va =100+ %i *200; // b u r d e n i n VA y = atand (( imag ( va ) /( real ( va ) ) ) ) ; // i n d e g r e e Zs = sqrt (( imag ( va ) ^2+ real ( va ) ^2) ) ; // m a g n i t u d e Kact = Kt +(( Kt *( Rs * cosd ( y ) + Xs * sind ( y ) ) ) ) / Zs ; // a c t u a l turn r a t i o Pr =( Knom - Kact ) / Kact ; // p e r c e n t a g e r a t i o n e r r o r pa =(( Xs * cosd ( y ) - Rs * sind ( y ) ) / Zs ) *(180/ %pi ) ; // c h a n g e in phase angle e r r o r in degree disp ( Pr *100 , ” p e r c e t a g e r a t i o e r r o r i s ” ) disp ( pa , ” p h a s e e r r o r i n d e g r e e i s ” )

90

Chapter 7 sensors and transducers

Scilab code Exa 7.2 displacement and resolution 1 // Example 7 . 2 // r e s o l u t i o n 2 clc ; 3 clear ; 4 close ; 5 // g i v e n d a t a : 6 l =50; // a l i n e a r r e s i s t a n c e 7 8 9 10 11 12 13 14 15 16 17 18 19 20

potentiometer lenth in

mm r =10000; // r e s i s t a n c e i n ohm rmin =10; // minimum m e a s u r a b l e r e s i s t a n c e i n ohm r1 =3850; // ‘ c a s e 1 i n ohm r2 =7560; // c a s e 2 i n ohm R1 = r /2; // i n ohm R2 = r / l ; // i n ohm/mm Rc = R1 - r1 ; D1 = Rc / R2 ; Rd = r2 - R1 ; // o p p o s i t e d i r e c t i o n i n ohm D2 = Rd / R2 ; R = rmin / R2 ; disp ( D1 , ” d i s p l a c e m e n t i n c a s e 1 , D1 (mm) = ” ) disp ( D2 , ” d i s p l a c e m e n t i n c a s e 2 , D2 (mm) = ” ) disp (R , ” r e s o l u t i o n , R(mm) = ” ) 91

Scilab code Exa 7.3 resistance 1 2 3 4 5 6 7 8 9 10 11 12

// Example 7 . 3 // r e s i s t a n c e clc ; clear ; close ; // g i v e n d a t a : R25 =100; // i n ohm alfa = -5/100; T1 =35; // i n d e g r e e c e l c i u s T2 =25; // i n d e g r e e c e l c i u s R35 = R25 *(1+ alfa *( T1 - T2 ) ) ; disp ( R35 , ” r e s i s t a n c e R35 ( ohm ) = ” )

Scilab code Exa 7.4 inductance 1 2 3 4 5 6 7 8 9 10 11 12 13 14

// Example 7 . 4 // i n d u c t a n c e clc ; clear ; close ; // g i v e n d a t a : l =1; // a i r gap l e n t h i n mm L1 =2; // i n mH D1 =0.02; // when a d i s p l a c e m e n t i s a p p l i e d l1 =l - D1 ; dL =( L1 *( l / l1 ) ) - L1 ; L = dL / L1 ; D = D1 / l ; disp ( L *10^2 , ” i n d u c t a n c e , L (mH) = ” ) 92

15 16

disp ( dL , ” i n d u c t a n c e , dL (mH) = ” ) disp (D , ” t h e r a t i o o f d i s p l a c e m e n t t o o r i g i n a l gap length ,D = ”)

Scilab code Exa 7.5 linearity 1 // Example 7 . 5 // LINEARITY 2 clc ; 3 clear ; 4 close ; 5 // g i v e n d a t a : 6 V =1.8; // t h e o u t p u t v o l t a g e 7 D =.0045; // t h e d e v i a t i o n from a s t r a i g h t

line

t h r o u g h t h e o r i g i n may be +ve or −ve 8 A =( D / V ) *100; 9 disp (A , ” a g e l i n e a r i t y , A(%) = ”)

Scilab code Exa 7.6 sensivity and resolution 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 7 . 6 // t h e s e n s i t i v i t y and r e s o l u t i o n clc ; clear ; close ; // g i v e n d a t a : Vo =1.8; // o u t p u t v o l t a g e D =0.6; // d i s p l a c e m e n t S = Vo / D ; Af =500; // a m p l i f i c a t i o n f a c t o r Sm = Af * S ; // i n mV/mm V =4000; // i n m i l i −v o l t s Sd = V /100; // one s c a l e d i v i s i o n Vmin =(1/4) * Sd ; // s c a l e can be r e a d t o 1/4 o f a division 93

14 R = Vmin *(1/ Sm ) ; 15 disp (S , ” s e n s i t i v i t y o f LVDT, S (mV/mm) = ” ) 16 disp (R , ” r e s o l u t i o n , R(mm) = ” )

Scilab code Exa 7.7.a capacitance 1 2 3 4 5 6 7 8 9 10 11 12

// Example 7 . 7 . a // d e t e r m i n e t h e v a l u e o f capacitance clc ; clear ; close ; // g i v e n d a t a : A =300; // p l a t e s o f a r e a i n mmˆ2 eo =8.85*10^ -12; // i n F/m er1 =1; er2 =8; // d i e l e c t r i c c o n t a n t o f mica d =0.2; // C =(( eo * er1 *10^ -6* A ) /( d *10^ -3) ) *10^12; disp (C , ” c a p a c i t a n c e , C( pF ) = ” )

Scilab code Exa 7.7.b change in capacitance 1 2 3 4 5 6 7 8 9 10 11

// Example 7 . 7 . // c h a n g e i n c a p a c i t a n c e clc ; clear ; close ; // g i v e n d a t a : A =300; // p l a t e s o f a r e a i n mmˆ2 eo =8.85*10^ -12; // i n F/m er1 =1; er2 =8; // d i e l e c t r i c c o n t a n t o f mica d1 =0.18; // d =0.2; // 94

12 13 14 15 16 17 18 19 20

D =d - d1 ; C =(( eo * er1 *10^ -6* A ) /( d *10^ -3) ) *10^12; C1 =(( eo * er1 *10^ -6* A ) /( d1 *10^ -3) ) *10^12; dC = C1 - C ; a = dC / C ; b=D/d; R=a/b; disp ( dC , ” c a p a c i t a n c e , dC ( pF ) = ” ) disp (R , ” r a t i o o f p e r u n i t c a h n g e o f c a p a c i t a n c e t o per u n i t change o f displacement ,R = ”)

Scilab code Exa 7.7.c original capacitance and change in capacitance 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

// Example 7 . 7 . c // r a t i o clc ; clear ; close ; // g i v e n d a t a : A =300; // p l a t e s o f a r e a i n mmˆ2 eo =8.85*10^ -12; // i n F/m er1 =1; er2 =8; // d i e l e c t r i c c o n t a n t o f mica d1 =0.01; // t h i c k n e s s o f mica d2 =0.02; // when a d i s p l a c e m e n t i s a p p l i e d d =0.2; // D =d - d1 ; D1 =D - d2 ; C =(( eo * A *10^ -6) /((( D / er1 ) +( d1 / er2 ) ) *10^ -3) ) *10^12; C1 =(( eo * A *10^ -6) /((( D1 / er1 ) +( d1 / er2 ) ) *10^ -3) ) *10^12; dC = C1 - C ; a = dC / C ; b = d2 / d ; R=a/b; disp (C , ” C a p a c i t a n c e ,C( pF )=” ) disp ( dC , ” c a p a c i t a n c e , dC ( pF ) = ” ) 95

23

disp (R , ” r a t i o o f p e r u n i t c a h n g e o f c a p a c i t a n c e t o per u n i t change o f displacement ,R = ”)

Scilab code Exa 7.8 voltage output and charge sensivity 1 2 3 4 5 6 7 8 9 10 11 12 13 14

// Example 7 . 8 // v o l t a g e o u t p u t and c h a r g e sensitivity clc ; clear ; close ; // g i v e n d a t a : t =2.5*10^ -3; // t h i c k q u a r t z i n mm g =0.055; // i n Vm/N p =1.4; // MN/mˆ2 e =40.6*10^ -12; // i n F E = g * t * p *10^6; C = e * g *10^12; disp (E , ” v o l t a g e o u t p u t , E(V) = ” ) disp (C , ” c h a r g e s e n s i t i v i t y , C( pC/N) = ” )

Scilab code Exa 7.9 force 1 2 3 4 5 6 7 8 9 10

// Example 7 . 9 // f o r c e clc ; clear ; close ; // g i v e n d a t a : A =6*6*10^ -6; // i n mˆ2 t =1.8*10^ -3; // i n m g =0.055; // i n Vm/N E =120; // i n v o l t s p = E /( g * t ) ; 96

11 F = p * A ; 12 disp (F , ” f o r c e , F (N) = ” )

Scilab code Exa 7.10 strain charge and capacitance 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

// Example 7 . 1 0 // s t r a i n c h a r g e and c a p a c i t a n c e clc ; clear ; close ; // g i v e n d a t a : A =6*6*10^ -6; // i n mˆ2 t =1.5*10^ -3; // i n m e =12.5*10^ -9; // i n F/m F =6; // i n N d =150*10^ -12; // i n F E =12*10^6; // i n N/mˆ2 p=F/A; S=p/E; g=d/e; E1 = g * t * p ; Q = d * F *10^12; C = Q / E1 ; disp (S , ” s t r a i n , S = ” ) disp (Q , ” c h a r g e , Q( pC ) = ” ) disp (C , ” c a p a c i t a n c e , C( pF ) = ” )

Scilab code Exa 7.11 hall angle 1 // Example 7 . 1 1 // t h e 2 clc ; 3 clear ; 4 close ;

hall angle

97

5 // g i v e n d a t a : 6 p =0.00912; // r e s i s t i v i t y 7 8 9 10 11 12 13 14 15

of semiconductor material i n ohm−m B =0.48; // i n Wb/mˆ2 Rh =3.55*10^ -4; // i n mˆ3/C Jx =1; Ex = p * Jx ; Ey = Rh * B * Jx ; t = Ey / Ex ; Theta = atand ( t ) temp = Theta - round ( Theta ) disp ( ” t h e h a l l a n g l e i s ” + string ( round ( Theta ) ) + ” d e g r e e and ” + string ( round ( temp *60) ) + ” min ” ) ;

Scilab code Exa 7.12 voltage 1 2 3 4 5 6 7 8 9 10 11 12 13 14

// Example 7 . 1 2 // v o l t a g e clc ; clear ; close ; // g i v e n d a t a : Rh =3.55*10^ -4; // h a l l c o e f f i c i e n t i n mˆ3/C I =0.015; // c u r r e n t i n A A =15*10^ -6; // a r e a i n mˆ2 B =0.48; // f l u x d e n s i t y i n Wb/mˆ2 Jx = I / A ; Ey = Rh * B * Jx ; V = Ey * A *10^3; disp (V , ” v o l t a g e b e t w e e n c o n t a c t , V(V) = ” )

Scilab code Exa 7.13 poissons ratio 98

1 // Example 7 . 1 3 // p o i s s o n ’ s r a t i o 2 clc ; 3 clear ; 4 close ; 5 // g i v e n d a t a : 6 Gf =4.2; 7 mu =( Gf -1) /2; 8 disp ( mu , ” p o i s s o n s r a t i o , mu = ” )

Scilab code Exa 7.14 change in resistance 1 // Example 7 . 1 4 // r e s i s t a n c e 2 clc ; 3 clear ; 4 close ; 5 // g i v e n d a t a : 6 alfa =20*10^ -6; // r e s i s t a n c e t e m p e r a t u r e 7 8 9 10 11 12 13 14 15 16 17 18

coefficient

in per degree c e l c i u s R =120; // i n ohm E =400; // i n MN/mˆ2 Gf =2; Me =200*10^9; // modulus o f e l a s t i c i t y i n N/mˆ2 Cs =(1/10) * E *10^6; // i n N/mˆ2 e = Cs / Me ; dR = R * Gf * e *10^3; // t =20; // t e m e r a t u r e i n d e g r e e c e l c i u s dR1 = R * alfa * t *10^3; disp ( dR , ” r e s i s t a n c e due t o c h a n g e i n s t r e s s , dR (m−ohm ) = ”) disp ( dR1 , ” r e s i s t a n c e due t o c h a n g e o f t e m p e r a t u r e , dR1 (m−ohm ) = ” ) //ANSWER I S WRONG IN THE TEXTBOOK

99

Scilab code Exa 7.15 change in length and amount of force 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

// Example 7 . 1 5 // c h a n g e i n l e n g t h and f o r c e clc ; clear ; close ; // g i v e n d a t a : E =207*10^9; // s t r a i n g a u g e i n N/mˆ2 L =0.12; // im m A =3.8*10^ -4; // i n mˆ2 R =220; // i n ohm Gf =2.2; dR =0.015; // i n ohm dL =((( dR / R ) * L ) / Gf ) ; a = E *( dL / L ) ; F = a * A /1000; disp ( dL , ” c h a n g e i n l e n g t h , L (m) = ” ) disp (F , ” t h e f o r c e , F ( kN ) = ” )

Scilab code Exa 7.16 strain 1 2 3 4 5 6 7 8 9 10

// Example 7 . 1 6 // s t r a i n clc ; clear ; close ; // g i v e n d a t a : Rg =100; // i n ohm Rsh =80000; // i n ohm Gf =2.1; // e =(1/ Gf ) *( Rg /( Rg + Rsh ) ) *10^6; disp (e , ” t h e s t r a i n , e ( m i c r o s t r a i n ) = ” )

Scilab code Exa 7.17 axial strain 100

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

// Example 7 . 1 7 // s t r a i n clc ; clear ; close ; // g i v e n d a t a : n =4; Rg =200; // i n ohm Rsh =100*10^3; // i n ohm Gf =2; // g a u g e f a c t o r e = Rg /( n * Gf *( Rg + Rsh ) ) ; // c a s e 1 −when t h e c a l i b r a t i o n s w i t c h i s c l o s e d , t h e r e a d o u t g i v e s a r e a d i n g o f 140 d i v i s i o n D = e /140; // c a s e 2 − when t h e s t r a i n g a u g e i s l o a d e d , t h e strain S = D *220*10^6; disp (S , ” t h e s t r a i n , S ( m i c r o s t r a i n ) = ” )

Scilab code Exa 7.18 longitudinal and hoop stresses 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 7 . 1 8 // t h e l o n g i t u d i n a l and hoop s t r e s s clc ; clear ; close ; // g i v e n d a t a : ex =0.00016; ey =0.00064; E =200*10^9; // i n N/mˆ 2 ] mu =0.26; a =( E *( ex +( mu * ey ) ) /(1 -( mu ) ^2) ) *10^ -6; b =( E *( ey +( mu * ex ) ) /(1 -( mu ) ^2) ) *10^ -6; disp (a , ” l o n g i t u d i n a l , a (MN/mˆ 2 ) = ” ) disp (b , ” hoop s t r e s s , b (MN/mˆ 2 ) = ” )

101

Scilab code Exa 7.19 modulus of elesticity and poissons ratio 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// Example 7 . 1 8 // t h e l o n g i t u d i n a l and hoop s t r e s s clc ; clear ; close ; // g i v e n d a t a : ex =1540; ey = -420; A =110*10^ -6; // i n mˆ2 P =25*10^3; // l o a d i n N ax = P / A ; by =0; E =( ax / ex ) ; mu =( ey * E ) / ax ; disp ( E *10^ -3 , ” modulus o f e l a s t i c i t y , E(GN/mˆ 2 ) = ” ) disp ( - mu , ” p o i s s o n r a t i o , ey = ” )

Scilab code Exa 7.21 principa strains principal stresses maximum shrea stress and princiole planes 1 2

3 4 5 6 7 8 9

// Example 7 . 2 1 : p r i n c i p l e s t r a i n s , p r i n c i p a l s t e s s , maximum s h r e a t s t r e s s and l o c a t i o n o f principle planes clc , clear // g i v e n : e1 =60; // i n m i c r o s t r a i n e2 =48; // i n m i c r o s t r a i n e3 = -12; // i n m i c r o s t r a i n E =200*10^9; // i n N/mˆ2 mu =0.3; 102

10 11 12 13 14 15 16 17 18 19 20 21 22

e_max =(( e1 + e3 ) /2) +(1/ sqrt (2) ) * sqrt (( e1 - e2 ) ^2+( e2 - e3 ) ^2) ; e_min =(( e1 + e3 ) /2) -(1/ sqrt (2) ) * sqrt (( e1 - e2 ) ^2+( e2 - e3 ) ^2) ; a_max = E *( e1 + e3 ) /(2*(1 - mu ) ) +(( E /( sqrt (2) *(1+ mu ) ) ) * sqrt (( e1 - e2 ) ^2+( e2 - e3 ) ^2) ) ; a_min = E *( e1 + e3 ) /(2*(1 - mu ) ) -(( E /( sqrt (2) *(1+ mu ) ) ) * sqrt (( e1 - e2 ) ^2+( e2 - e3 ) ^2) ) ; tau_max =( E /( sqrt (2) *(1+ mu ) ) ) * sqrt (( e1 - e2 ) ^2+( e2 - e3 ) ^2) ; A = atand ((2* e2 - e1 - e3 ) /( e1 - e3 ) ) ; B = A /2; disp ( e_max *10^ -6 , ” p r i n c i p l e s t r a i n ( e max ) ” ) disp ( e_min *10^ -6 , ” p r i n c i p l e s t r a i n ( e m i n ) ” ) disp ( a_max *10^ -12 , ” p r i n c i p l e s t r e s s e s ( a max ) i n MN/ mˆ2 ” ) disp ( a_min *10^ -12 , ” p r i n c i p l e s t r e s s e s ( a m i n ) i n MN/m ˆ2 ” ) disp ( tau_max *10^ -12 , ”maximm s h e a r s t r e s s ( tau max ) i n MN/mˆ2 ” ) disp (B , ” l o c a t i o n o f t h e p r i n c i n p l e p l a n e s (B) i n degree ”)

Scilab code Exa 7.22 sensivity 1 2 3 4 5 6 7 8 9 10

// Example 7 . 2 2 // s e n s i t i v i t y clc ; clear ; close ; // g i v e n d a t a : d =0.06; // i n mm Rg =120; // i n ohm Gf =2; // g a u g e f a c t o r v =6; // im v o l t s E =200; // GN/mˆ2 103

11 12 13 14 15 16 17 18

mu =0.3; // p o i s s o n ’ s r a t i o l =1000; // c o n s i d e r a l o a d a p p l i e d i n N Si = l /(( %pi /4) *( d ) ^2) e = Si /( E *10^9) ; R = Gf * e ; dVo =2*(1+ mu ) * R *( v /4) *10^ -6; S = dVo /( l *1000) ; disp ( S *10^18 , ” t h e s e s i t i v i t y , S ( m i c r o v o l t /kN ) = ” )

104

Chapter 8 signal conditioning

Scilab code Exa 8.1 total voltage gain 1 2 3 4 5 6 7 8 9 10 11

// Example 8 . 1 // t o t a l v o l t a g e g a i n clc ; clear ; g1 =100; // FIRST STAGE GAIN g1db =20*( log10 ( g1 ) ) ; // f i r s t s t a g e g a i n i n db g2 =200; // s e c o n d s t a g e g a i n g2db =20*( log10 ( g2 ) ) ; // s e c o n d s t a g e g a i n i n db g3 =400; // t h i r d s t a g e g a i n g3db =20*( log10 ( g3 ) ) ; // t h i r d s t a g e g a i n i n db Tdb = g1db + g2db + g3db ; // disp ( Tdb , ” t o t a l g a i n i n dB” )

Scilab code Exa 8.2 total gain and resultant gain 1 // Example 8 . 2 //POWER GAIN AND RESULTANTT POWER GAIN 2 clc ; 3 clear ; 4 g1 =30; //ABSOLUTE GAIN FOR EACH STAGE

105

5 6 7 8 9 10 11

N =5; // no . o f s t a g e s Pdb =10*( log10 ( g1 ) ) ; // power g a i n i n db Ndb = Pdb * N ; // power g a i o f 5 s t a g e s i n db Nfb =10; //NEGATIVE FEEDBACK IN DB Rpg = Ndb - Nfb ; //RESULTANT POWER GAIN IN db disp ( Ndb , ” power g a i n i n db ” ) disp ( Rpg , ” r e s u l t a n t power g a i n i n db ” )

106

Chapter 12 measurement of non electrical quantities

Scilab code Exa 12.1.b percentage change 1 2 3 4 5 6 7 8 9 10 11 12

// Example 1 2 . 1 . b // p e r c e n t a g e clc ; clear ; close ; // g i v e n d a t a : Gf =2; // g a u g e f a c t o r a =100; // s t r e s s i n MN/mˆ2 E =200; // modulus o f e l a s t i c i t y i n GN/mˆ2 S =( a *10^6) /( E *10^9) ; R = Gf * S ; P = R *100; disp (P , ” p e r c e n t a n g e c h a n g e i n r e s i s t a n c e , P(%) = ” )

Scilab code Exa 12.4 water flow rate 1

// Example 1 2 . 4 // t h e w a t e r f l o w r a t e 107

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

clc ; clear ; close ; // g i v e n d a t a : D1 =0.2; // i n m D2 =0.1; // i n m h =220; // i n mm Cd =0.98; ph =13.6; pw =1; // i n Kg/mˆ3 g =9.81; P = g * h *10^ -3*( ph - pw ) *1000; M =1/ sqrt (1 -( D2 / D1 ) ^4) A2 =( %pi /4) * D2 ^2; Q =( Cd * M * A2 * sqrt ((2* g / g *1000) * P ) ) *10^ -3; disp (Q , ” w a t e r f l o w r a t e , Q(mˆ3/ s ) = ” )

Scilab code Exa 12.5 rate of flow 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 1 2 . 5 // r a t e o f f l o w o i n p i p e l i n e clc ; clear ; D1 =0.4; // d i a m e t e r o f p i p e a t i n l e t A1 = ( %pi /4) * D1 ^2; // a r e a o f i n l e t i n m e t e r s q u a r e D2 =0.2; // t h r o a t d i a m e t e r i n m e t e r A2 =( %pi /4) * D2 ^2; // a r e a o f t h r o a t i n m e t e r s q u a r e y =0.05; // r e a d i n g o f t h e d i f f e r n t i a l manometer i n meter Shl =13.6; // SPECIFIC GRAVITY OF HEAVY LIQUID Sp =0.7; // SPECIFIC GRAVITY OF OIL FLOWING THE PIPELINE h = y *(( Shl / Sp ) -1) ; // d i f f e r n t i a l p r e s s u r e head i n meter g =9.81; // assume V2 = sqrt ( h /((1/(2* g ) ) -(1/(32* g ) ) ) ) ; // 108

14 V1 =( A2 * V2 ) / A1 ; // 15 Q = A2 * V2 ; // 16 disp (Q , ” r a t e o f f l o w o f

o i l i n mˆ3/ s i s ” )

Scilab code Exa 12.6 differecne in pressure head 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

// Example 1 2 . 6 // d i f f e r e n c e clc ; clear ; close ; // g i v e n d a t a : Q =0.015; // i n mˆ3/ s D0 =0.1; // i n m D1 =0.2; // i n m Cc =0.6; Cd =0.6; g =9.81; AO =(( %pi /4) * D0 ^2) ; // i n mˆ2 A1 =(( %pi /4) * D1 ^2) ; // i n mˆ2 K = Cd / sqrt (1 -( Cc *( AO / A1 ) ) ^2) ; S = sqrt ((2* g ) /( g *1000) ) ; DP =(( Q /( K * AO * S ) ) ) ^2; // disp ( ” d i f f e r e n c e i n t h r p r e s s u r e head i s ” + string ( DP ) + ” N/mˆ2 o r ” + string ( DP /9739.45) + ” m o f w a t e r ” )

Scilab code Exa 12.7 flow rate 1 // Example 1 2 . 7 // f l o w 2 clc ; 3 clear ; 4 close ; 5 // g i v e n d a t a :

rate

109

6 7 8 9 10

Qv =1.2; // mˆ3/ s C0 =0.6; // d i s c h a r g e c o e f i c i e n t o f o r i f i c e Cv =0.97; // d i s c h a r g e c o e f i c i e n t Q0 =( C0 / Cv ) * Qv ; disp ( Q0 , ” t h e f l o w r a t e , Q0 (mˆ3/ s ) = ” )

Scilab code Exa 12.8 speed of sub marine 1 2 3 4 5 6 7 8 9 10 11 12 13

// Example 1 2 . 8 // s p e e d clc ; clear ; close ; // g i v e n d a t a : g =9.81; // g r a v i t y og e a r t h Sh =13.6; // g r a v i t y o f m e r c u r y Sl =1.025; // g r a v i t y o f s e a w a t e r y =0.2; // r e a d i n g o f t h e manometer i n m h = y *(( Sh / Sl ) -1) ; V = sqrt (2* g * h ) ; disp ( ” v e l o c i t y o f sub−marine , V(m/ s ) ” + string ( V ) + ” o r ” + string ( V *(3.6) ) + ” km/h ” )

110

Chapter 13 Additional or supplement topics

Scilab code Exa 13.1 resistance and inductance 1 2 3 4 5 6 7 8 9 10 11 12 13 14

// Example 1 3 . 1 // r e s i s t a n c e and i n d u c t a n c e clc ; clear ; close ; // g i v e n d a t a : Q =1000; // i n ohm S=Q; P =500; // i n ohm r =100; // i n ohm C =0.5; // i n micro −f a r a d R =( P * Q ) / S ; L =(( C *10^ -6* P ) / S ) *( r *( Q + S ) +( Q * S ) ) ; disp (R , ” r e s i s t a n c e , R( ohm ) = ” ) disp (L , ” i n d u c t a n c e , L (H) = ” )

Scilab code Exa 13.2 resistance and inductance 111

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

// Example 1 3 . 2 // r e s i s t a n c e and i n d u c t a n c e clc ; clear ; close ; // g i v e n d a t a : R2 =1000; // i n ohm R3 =500; // i n ohm R4 =1000; // i n ohm r =100; // i n ohm C =3; // i n micro −f a r a d R =( R2 * R3 ) / R4 ; L =(( C *10^ -6* R2 ) / R4 ) *( r *( R3 + R4 ) +( R3 * R4 ) ) ; disp (R , ” r e s i s t a n c e , R( ohm ) = ” ) disp (L , ” i n d u c t a n c e , L (H) = ” )

Scilab code Exa 13.3 effective impedence 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

// Example 1 3 . 3 // i m p e d a n c e clc ; clear ; close ; // g i v e n d a t a : C3 =0.124; // i n micro −f a r a d R3 =834; // i n ohm C4 =0.1; // i n micro −f a r a d f =2000; // i n Hz R2 =100; // i n ohm L1 = R2 * R3 * C4 *10^ -6; R1 = R2 *( C4 / C3 ) ; X1 =2* %pi * f * L1 ; Z1 = sqrt ( R1 ^2+ X1 ^2) ; disp ( R1 , ” r e s i s t a n c e i n ohms i s ” ) disp ( Z1 , ” i m p e d a n c e o f t h e s p e c i m e n , Z1 ( ohm ) = ” )

112

Scilab code Exa 13.4 capacitance and equivalent series 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// Example 1 3 . 4 // c a p a c i t a n c e and s e r i e s r e s i s t a n c e clc ; clear ; close ; // g i v e n d a t a : M =18.35; // i n m−H R1 =200; // i n ohm L1 =40.6; // i n m−H R2_1 =119.5; // i n ohm R4 =100; // i n ohm C2 =(( M *10^ -3) /( R1 * R4 ) ) *10^6; R2 =( R4 *( L1 - M ) ) / M ; Rs = R2 - R2_1 ; disp ( C2 , ” c a p a c i t a n c e , C( micro −f a r a d ) = ” ) disp ( Rs , ” t h e s e r i e s r e s i s t a n c e , Rs ( ohm ) = ” )

113