Scilab Textbook Companion for A Course In Mechanical Measurements And Instrumentation by A. K. Sawhney And P. Sawhney1 Created by Parul Instrumentation Electrical Engineering Thapar University College Teacher Dr. Sunil K Singla Cross-Checked by
May 23, 2016
1
Funded by a grant from the National Mission on Education through ICT, http://spoken-tutorial.org/NMEICT-Intro. This Textbook Companion and Scilab codes written in it can be downloaded from the ”Textbook Companion Project” section at the website http://scilab.in
Book Description Title: A Course In Mechanical Measurements And Instrumentation Author: A. K. Sawhney And P. Sawhney Publisher: Dhanpat Rai, New Delhi Edition: 12 Year: 2001 ISBN: 8177000233
1
Book Description Title: A Course In Mechanical Measurements And Instrumentation Author: A. K. Sawhney And P. Sawhney Publisher: Dhanpat Rai, New Delhi Edition: 12 Year: 2001 ISBN: 8177000233
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
2 Static Characteristics of Instruments and Measurement systems
5
3 Errors in Measurements and Their Statistical Analysis
18
4 Dynamic Characteristics of Instruments and Measurement systems
41
5 Primary Sensing Elements and Transducers
52
6 Signal Conditioning
77
7 Display Devices and recorders
93
8 Metrology
99
9 Pressure Measurements
104
3
List of Scilab Codes Exa 2.1 Exa 2.2 Exa 2.3 Exa 2.4 Exa 2.5
Exa 2.6 Exa 2.7 Exa 2.8 Exa 2.9
Exa 2.10 Exa 2.12 Exa 2.13 Exa 2.14 Exa 2.15 Exa 2.16 Exa 2.17 Exa 2.18
calculating static error and static correction . . . . . . calculating true value of the temperature . . . . . . . calculating Relative error expressed as a percentage of f sd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . calculating static error and static correction . . . . . . calculating maximum static error Span of the thermometer degree C Accuracy of the thermometer in terms of percentage of span . . . . . . . . . . . . . . . . . . . . calculating the pressure for a dial reading of 100 . . . calculating the noise output voltage of the amplifier . calculating the noise voltage . . . . . . . . . . . . . . . calculating the signal to noise ratio at input calculating the signal to noise ratio at output calculating the noise factor and noise figure . . . . . . . . . . . . . . . . . . calculating the ratio of output signal to noise signal . . calculating the average force and range of error . . . . calculating the sum of resistances connected in series with uncertainity of one unit . . . . . . . . . . . . . . calculating the power with uncertainity of one unit in voltage and current . . . . . . . . . . . . . . . . . . . calculating the sum of resistances connected in series with appropriate number of significant figure . . . . . calculating the voltage drop with appropriate number of significant figure . . . . . . . . . . . . . . . . . . . . calculating the sensitivity and deflection factor of wheatstone bridge . . . . . . . . . . . . . . . . . . . . . . . calculating the volume of the mercury thermometer . .
4
5 5 6 6
7 7 8 8
9 9 10 10 11 11 12 12 13
Exa 2.19 Exa 2.20 Exa 2.22 Exa 2.23 Exa 2.24 Exa 2.25 Exa 2.26 Exa 2.27 Exa 2.28 Exa 2.29 Exa 3.1 Exa 3.2 Exa 3.3 Exa 3.4 Exa 3.5 Exa 3.6 Exa 3.7 Exa 3.8 Exa 3.9 Exa 3.10 Exa 3.11 Exa 3.12 Exa 3.13 Exa 3.14 Exa 3.15 Exa 3.16 Exa 3.17 Exa 3.18
calculating the maximum position deviation resistance deviation . . . . . . . . . . . . . . . . . . . . . . . . . calculating the dead zone . . . . . . . . . . . . . . . . calculating the Resolution . . . . . . . . . . . . . . . . calculating the Resolution . . . . . . . . . . . . . . . . calculating the reading of the multimeter and percentage error . . . . . . . . . . . . . . . . . . . . . . . . . calculating the reading of the multimeter and percentage error . . . . . . . . . . . . . . . . . . . . . . . . . calculating the loading error . . . . . . . . . . . . . . . calculating the voltage across the oscilloscope . . . . . calculating the actual value of current measured value of current and percentage error . . . . . . . . . . . . . calculating the maximum available power . . . . . . . calculating guarantee value of capacitance . . . . . . . calculating percentage limiting error . . . . . . . . . . Calculate the range of readings . . . . . . . . . . . . . Calculate the limiting error in percent . . . . . . . . . Calculate the range of readings specified interms of fsd and true value . . . . . . . . . . . . . . . . . . . . . . Calculate the magnitude and limiting error in ohm and in percentage of the resistance . . . . . . . . . . . . . calculate the value of relative limiting error in resistance Calculate the guaranteed values of the resistance . . . Calculate the percentage limiting error and range of resistance values . . . . . . . . . . . . . . . . . . . . . . Calculate the magnitude of power and limiting error . Calculate the magnitude of Force and limiting error . calculate the power loss and relative error . . . . . . . Calculate the true power as a percentage of measured power . . . . . . . . . . . . . . . . . . . . . . . . . . . calculate the total resistance error of each register and fractional error of total resistance . . . . . . . . . . . . find the error . . . . . . . . . . . . . . . . . . . . . . . calculate the Volume and relative error . . . . . . . . . calculate the per unit change in the value of spring for different temperature ranges . . . . . . . . . . . . . . Calculate apparent resistance actual resistance and error 5
13 13 14 14 14 15 15 16 16 17 18 18 19 19 20 20 21 21 22 23 23 24 24 25 26 26 27 27
Exa 3.19 Exa 3.20 Exa 3.21 Exa 3.22 Exa 3.23
Exa 3.24 Exa 3.25 Exa 3.26 Exa 3.27 Exa 3.28 Exa 3.29 Exa 3.30 Exa 3.31 Exa 3.32 Exa 3.34 Exa 3.35 Exa 3.37 Exa 3.38 Exa 3.39 Exa 3.40 Exa 3.41 Exa 4.1 Exa 4.2 Exa 4.4 Exa 4.5 Exa 4.6 Exa 4.8 Exa 4.9
Calculate apparent resistance actual resistance and error Calculate the error and percentage error in the measurement of deflection . . . . . . . . . . . . . . . . . . . . to find the mean deviations from the mean Average deviation standard deviation and variance . . . . . . . . to find the mean standard deviation probable error and range . . . . . . . . . . . . . . . . . . . . . . . . . . . to find the arithematic mean maen deviation standard deviation prpobable error of 1 reading standard deviation and probable error of mean standard deviation of standard deviation . . . . . . . . . . . . . . . . . . . . to find probable no of resistors . . . . . . . . . . . . . to find no of 100 rsding exceed 30mm . . . . . . . . . to find no of rods of desired length . . . . . . . . . . . to find standard deviation and probability of error . . to find no of expected readings . . . . . . . . . . . . . to calculate precision index of instrument . . . . . . . to find confidence interval for given confidence levels . to point out the reading that can be rejected by chavenets criterion . . . . . . . . . . . . . . . . . . . . . . . . . . calculate standard deviation . . . . . . . . . . . . . . . determine value of total current considering errors as limiting errors ans as standrd deviations . . . . . . . . determine probable error in the computed value of resistnce . . . . . . . . . . . . . . . . . . . . . . . . . . . to find Cq and its possible errors . . . . . . . . . . . . calculate power disipated and uncertaainity in power . to find uncertainity in combined resistance in both series and in parrallel . . . . . . . . . . . . . . . . . . . . . . to calculate uncertainity in measurement . . . . . . . . to calculate uncertainity in power . . . . . . . . . . . . calculating the temperature . . . . . . . . . . . . . . . calculate time to read half of the temperature difference Calculate the temperature after 10s . . . . . . . . . . Calculate the value of resistance after 15s . . . . . . . Calculate the depth after one hour . . . . . . . . . . . Calculate time constant . . . . . . . . . . . . . . . . . Calculate the temperature after 10s . . . . . . . . . . 6
28 28 29 30
30 31 31 32 32 33 33 34 35 35 36 37 37 38 38 39 40 41 41 42 42 42 43 43
Exa 4.10 Exa 4.11 Exa 4.12 Exa 4.13
Exa 4.14 Exa 4.15 Exa 4.16 Exa 4.17 Exa 4.18 Exa 4.19 Exa 4.20 Exa 4.21 Exa 4.22 Exa 4.23 Exa 5.1 Exa 5.2 Exa 5.3 Exa 5.4 Exa 5.5 Exa 5.6 Exa 5.7 Exa 5.8 Exa 5.9 Exa 5.10 Exa 5.11 Exa 5.12 Exa 5.13 Exa 5.14
Calculate the temperature at a depth of 1000 m . . . . Calculate the value of resistance at different values of time . . . . . . . . . . . . . . . . . . . . . . . . . . . . calculate the value of damping constant and frequency of damped oscillations . . . . . . . . . . . . . . . . . . Calculate damping ratio natural frequency frequency of damped oscillations time constant and steady state error for ramp signal . . . . . . . . . . . . . . . . . . . . . . Calculate the natural frequency . . . . . . . . . . . . . Calculate natural frequency and setteling time . . . . Calculate time lag and ratio of output and input . . . Calculate the maximum allowable time constant and phase shift . . . . . . . . . . . . . . . . . . . . . . . . Calculate maximum value of indicated temperature and delay time . . . . . . . . . . . . . . . . . . . . . . . . Find the output . . . . . . . . . . . . . . . . . . . . . Calculate maximum and minimum value of indicated temperature phase shift time lag . . . . . . . . . . . . determine damping ratio . . . . . . . . . . . . . . . . . Calculate the frequency range . . . . . . . . . . . . . . determine the error . . . . . . . . . . . . . . . . . . . Calculate the deflection at center . . . . . . . . . . . . Calculate the angle of twist . . . . . . . . . . . . . . . Calculate the Torque . . . . . . . . . . . . . . . . . . . Calculating the displacement and resolution of the potentiometer . . . . . . . . . . . . . . . . . . . . . . . . plot the graph of error versus K . . . . . . . . . . . . . Calculating the output voltage . . . . . . . . . . . . . Calculating the maximum excitation voltage and the sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . Calculating the resolution of the potentiometer . . . . Checking the suitability of the potentiometer . . . . . Checking the suitability of the potentiometer . . . . . Calculating the possion ratio . . . . . . . . . . . . . . Calculating the value of the resistance of the gauges . calculate the percentage change in value of the gauge resistance . . . . . . . . . . . . . . . . . . . . . . . . . Calculating the Gauge factor . . . . . . . . . . . . . . 7
44 44 45
46 46 47 47 48 48 49 49 50 51 51 52 52 53 53 54 54 54 55 55 56 56 56 57 57
Exa 5.15 Exa 5.16 Exa 5.17 Exa 5.18 Exa 5.19 Exa 5.20 Exa 5.21 Exa 5.22 Exa 5.23 Exa 5.24 Exa 5.25 Exa 5.26 Exa 5.27 Exa 5.28 Exa 5.29 Exa 5.30 Exa 5.31 Exa 5.32 Exa 5.33 Exa 5.34 Exa 5.35 Exa 5.36 Exa 5.37 Exa 5.40 Exa 5.41 Exa 5.42 Exa 5.43
Exa 5.44 Exa 5.45
Exa 5.46
Calculating the change in length and the force applied Calculate the linear approximation . . . . . . . . . . . Calculate the linear approximation . . . . . . . . . . . Calculate the resistance and the temperature . . . . . Calculate the resistance . . . . . . . . . . . . . . . . . Calculate the time . . . . . . . . . . . . . . . . . . . . Calculate the resistance . . . . . . . . . . . . . . . . . find resistance . . . . . . . . . . . . . . . . . . . . . . calculating the change in temperature . . . . . . . . . calculating the frequencies of oscillation . . . . . . . . Calculating the sensitivity and maximum output voltage Calculating the temperature . . . . . . . . . . . . . . . Calcating the series resistance and approximate error . Calculate the values of resistance R1 and R2 . . . . . Calculate the percentage linearity . . . . . . . . . . . . Calculate senstivity of the LVDT . . . . . . . . . . . . calculate the deflection maximum and minimum force calculating the sensitivity of the transducer . . . . . . Calculate the value of the capacitance afte the application of pressure . . . . . . . . . . . . . . . . . . . . . . Calculate the change in frequency of the oscillator . . Calculate the dielectric stress change in value of capacitance . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculate the value of time constant phase shift series resistance amplitude ratio and voltage sensitivity . . . Calculate the change in capacitance and ratio . . . . . Calculate the output voltage and charge sensitivity . . Calculate the force . . . . . . . . . . . . . . . . . . . . Calculate the strain charge and capacitance clc . . . . calculate peak to peak voltage swing under open and loaded conditions calculate maximum change in crystal thickness . . . . . . . . . . . . . . . . . . . . . . . . . Calculate the minimum frequency and phase shift . . . calculate sensitivity of the transducer high frequency sensitivity Lowest frequency Calculate external shunt capacitance and high frequency sensitivity after connecting the external shunt capacitance . . . . . . . . . calculate op volatge . . . . . . . . . . . . . . . . . . . 8
58 58 59 59 60 60 60 61 61 62 62 63 63 63 64 64 65 65 66 66 67 67 68 69 69 69
70 71
71 72
Exa 5.47 Exa 5.48 Exa 5.49 Exa 5.50 Exa 5.51 Exa 5.52 Exa 5.53 Exa 5.54 Exa 6.1 Exa 6.2 Exa 6.3 Exa 6.4 Exa 6.5 Exa 6.6 Exa 6.7 Exa 6.8 Exa 6.9 Exa 6.10 Exa 6.11 Exa 6.12 Exa 6.13 Exa 6.14 Exa 6.15 Exa 6.16 Exa 6.17 Exa 6.19 Exa 6.20 Exa 6.21 Exa 6.22 Exa 6.23 Exa 6.24 Exa 6.25
to prove time constant should be approximately 20T . calculate op volatge . . . . . . . . . . . . . . . . . . . Calculate the threshold wavelength . . . . . . . . . . . Calculate maximum velocity of emitted photo electrons Calculate the resistance of the cell . . . . . . . . . . . Calculate incident power and cut off frequency . . . . Calculate the internal resistance of cell and open circuit voltage . . . . . . . . . . . . . . . . . . . . . . . . . . Find the value of current . . . . . . . . . . . . . . . . calculating feedback resistance . . . . . . . . . . . . . calculating the closed loop gain . . . . . . . . . . . . . calculating the maximum output voltage . . . . . . . . calculating output voltage due to offset voltage . . . . calculating Amplification factor . . . . . . . . . . . . . calculating output voltage due to offset voltage . . . . calculating gain and feedback resistance . . . . . . . . Calculating the values of resistances . . . . . . . . . . Calculating the value of resistance and capacitance . . Calculating Difference mode gain and output voltage . Calculating Difference mode Common mode gain and CMRR . . . . . . . . . . . . . . . . . . . . . . . . . . Calculating Signal to noise ratio and CMRR . . . . . . Calculating sensitivity and output voltage . . . . . . . calculating minimum maximum time constants and value of frequencies . . . . . . . . . . . . . . . . . . . . . . . calculating time constant and value of capacitance . . calcuating the passband gain and upper and lower cut off frequencies . . . . . . . . . . . . . . . . . . . . . . calcuating the value of C . . . . . . . . . . . . . . . . calculate the output voltage and sensitivity . . . . . . calculate the output voltage for different values of K . calculating the resistance and output voltage . . . . . Calculating the bridge output . . . . . . . . . . . . . . Calculating the resistance of unknown resistance . . . calculating the current . . . . . . . . . . . . . . . . . . Calculating maximum permissible current through strain gauge supply voltage and Power dissipation in series resistance . . . . . . . . . . . . . . . . . . . . . . . . . . 9
73 73 74 74 74 75 75 76 77 77 78 78 78 78 79 79 80 80 81 81 82 82 83 83 84 84 85 85 86 86 87
87
Exa 6.26 Exa 6.27 Exa 6.28 Exa 6.29 Exa 6.30
Exa 6.31 Exa 6.32 Exa 6.33 Exa 6.34 Exa 7.1 Exa 7.2 Exa 7.3 Exa 7.4 Exa 7.5 Exa 7.6 Exa 7.7 Exa 7.8 Exa 7.9 Exa 7.10 Exa 8.1 Exa 8.2 Exa 8.3 Exa 8.4 Exa 8.5 Exa 8.6 Exa 8.7 Exa 9.1 Exa 9.2 Exa 9.3 Exa 9.4 Exa 9.6
Calculating the maximum voltage sensitivity of the bridge Calculating the resolution of the instrument quantization error and decesion levels . . . . . . . . . . . . . . Calculating the weight of MSB and LSB . . . . . . . . Calculating reference voltage and percentage change . Calculating the number of bits Value of LSB Quantization error minimum sampling rate Aperature time and dynamic range . . . . . . . . . . . . . . . . . . . . . . Calculating the value of resistance and smallest output current . . . . . . . . . . . . . . . . . . . . . . . . . . Calculating the output voltage . . . . . . . . . . . . . Calculate the output of successive approximation A to D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . to calculate op dc voltage . . . . . . . . . . . . . . . . calculating resolution . . . . . . . . . . . . . . . . . . calculating resolution . . . . . . . . . . . . . . . . . . calculating Total possible error and percentage error . calculating frequency . . . . . . . . . . . . . . . . . . . calculating maximum error . . . . . . . . . . . . . . . calculating number of turns and current . . . . . . . . calculating speed of the tape . . . . . . . . . . . . . . calculating number density of the tape . . . . . . . . . Calculating possible phase angles . . . . . . . . . . . . Calculating possible phase angles . . . . . . . . . . . . calculate the arrangement of slip gauges . . . . . . . . calculate the sensitivity . . . . . . . . . . . . . . . . . calculate uncertainity in displacement . . . . . . . . . calculate difference between height of workpieces and pile of slip gauges . . . . . . . . . . . . . . . . . . . . calculate seperation distance between two surfaces and angle of tilt . . . . . . . . . . . . . . . . . . . . . . . . Calculate the difference in two diameters . . . . . . . . Calculate the change in thickness along its length . . . calculating the length of mean free path . . . . . . . . Calculate Pressure of air source . . . . . . . . . . . . . Calculate Pressure head . . . . . . . . . . . . . . . . . calculate height . . . . . . . . . . . . . . . . . . . . . . calculate error interms of pressure . . . . . . . . . . . 10
88 88 89 89
89 90 91 91 92 93 93 94 95 95 95 96 96 97 97 99 100 101 101 102 102 102 104 105 105 106 106
Exa 9.7 Exa 9.8 Exa 9.9 Exa 9.10 Exa 9.11 Exa 9.12 Exa 9.13
Exa 9.14 Exa 9.15 Exa 9.16 Exa 9.17 Exa 9.18 Exa 9.19 Exa 9.20
calculate angle to which tube is incliend to vertical . . calculate angle to which tube is incliend to horizontal calculate Length of scale angle to which tube is incliend to horizontal . . . . . . . . . . . . . . . . . . . . . . . calculate diameter of the tube . . . . . . . . . . . . . . calculate amplification ratio and percentage error . . . calculate value of counter weight required . . . . . . . calculate damping factor time constant error and time lag calculate damping factor natural frequency time constant error and time lag . . . . . . . . . . . . . . . . . calculate thickness of diaphram and natural frequency calculate the natural length of the spring and dispacement . . . . . . . . . . . . . . . . . . . . . . . . . . . calculate the open circuit voltage . . . . . . . . . . . . calculate the optimum setting . . . . . . . . . . . . . . calculate the output voltage of bridge . . . . . . . . . calculate attenuation . . . . . . . . . . . . . . . . . . . calculate error . . . . . . . . . . . . . . . . . . . . . .
11
106 107 107 108 108 109
109 110 111 111 112 113 113 114
Chapter 2 Static Characteristics of Instruments and Measurement systems
Scilab code Exa 2.1 calculating static error and static correction
1 // c a l c u l a t i n g s t a t i c e r r o r a nd s t a t i c c o r r e c t i o n 2 clc ; 3 disp ( ’ c a l c u l a t i n g s t a t i c e r r o r and s t a t i c c o r r e c t i o n ’) 4 A m = 1 27 .5 0; 5 A t = 1 27 .4 3; 6 e=Am-At; 7 disp (e , ’ S t a t i c e r r o r (V)= ’ ) ; 8 Sc=-e; 9 disp ( S c , ’ S t a t i c C o r r e c t i o n (V)= ’ ) ;
Scilab code Exa 2.2 calculating true value of the temperature
1 / / c a l c u l a t i n g t r u e v al ue o f t h e t em pe ra tu re
12
2 3 4 5 6 7
clc ; disp ( ’ c a l c u l a t i n g t r u e v a l u e o f t he h e t em e m pe p e ra r a tu t u re re ’ ) A m = 9 5. 5 . 45 45 ; Sc=-0.08; At=Am+Sc; disp ( A t , ’ T r ue ue T e m p e r a t u r e ( D e g r e e C )= )= ’ ) ;
Scilab code Exa 2.3 calculating Relative error expressed as a percentage
of f s d 1 // calculating
R e la t iv e e r r o r ( e xp re ss ed a s a percentage of f . s . d)
2 clc ; 3 disp ( ’ c a l c u l a t i n g
R el a ti v e e r r o r ( e xp re ss ed as a percentage of f . s . d) ’ )
4 5 6 7 8 9 10 11
12 13
A m = 1 .4 . 4 6; 6; At=1.50; e=Am-At; disp ( e , ’ A b s o l u t e e r r o r ( V ) = ’ ) ; Sc=-e; disp ( S c , ’ A b s o l u t e C o r r e c t i o n ( V ) = ’ ) ; RE=(e/At)*100; disp ( R E , ’ R e l a t i v e E r ro r o r i n t er e r ms m s o f t r u e v a lu lu e ( i n p e r c e n t a g e )= ’ ) ; REF=(e/2.5)*100; disp ( R E F , ’ R e l a t i v e E rr r r o r i n t er e r ms m s o f t r u e v a lu lu e ( i n p e r c e n t a g e )= ’ ) ;
Scilab code Exa 2.4 calculating static error and static correction
1 // // c a l c u l a t i n g 2 clc ;
s t a t i c e r r o r a nd s t a t i c c o r r e c t i o n
13
3 disp ( ’ c a l c u l a t i n g s t a t i c e r r o r a n d s t a t i c ’) 0 0 0 16 16 1 ; 4 A m = 0 . 00 . 1 5 9* 9 * 10 10 ^ - 3 ; 5 A t = 0 .1 6 e=Am-At; 7 disp ( e , ’ S t a t i c e r r o r ( m3 m3 / s ) = ’ ) ; 8 Sc=-e; 9 disp ( S c , ’ S t a t i c C o r r e c t i o n ( m3 m3 / s ) = ’ ) ;
c o rr e ct i o n
Scilab code Exa 2.5 calculating maximum static error Span of the ther-
mometer degree C Accuracy of the thermometer in terms of percentage of span 1 2 3 4 5
/ / c a l c u l a t i n g maximum s t a t i c e r r o r disp ( ’ c a l c u l a t i n g maximum s t a t i c e r r o r ’ ) ; / / Sp S p an an o f t h e t h er e r m o me m e t er er ( d e g r e e C ) S=200-150;
/ / A cc c c ur u r ac a c y o f t h e t he h e rm r m om o m et e t er e r ( i n t er e r ms ms o f p e r c e n t a g e o f s pa pa n )
6 A=0.0025; S; 7 e = A * S; 8 disp ( e , ’ Ma Maximum S t a t i c
e r r o r ( d e g r e e C )= )= ’ ) ;
Scilab code Exa 2.6 calculating the pressure for a dial reading of 100
1 // / / c a l c u l a t i n g t h e p r e s s u r e f o r a d i a l r ea e a di di ng o f
100 2 clc ; 3 disp ( ’ c a l c u l a t i n g t h e p r e s s u r e f o r a d i a l r ea e a d i ng ng o f 100 ’ ) 4 P=((27.58-6.895)/150)*100+6.895; 5
14
6 disp ( P , ’ p r e s s u r e ;
f o r a d i a l r e a di d i n g o f 1 0000 (k ( kN / m2 ) = ’ )
Scilab code Exa 2.7 calculating the noise output voltage of the amplifier
1 // / / c a l c u l a t i n g t he h e n o i s e o u tp t p ut ut v o l t a g e o f t h e
amplifier 2 clc ; 3 disp ( ’ c a l c u l a t i n g t he h e n o i s e o ut ut p u t v o l t a g e o f t h e amplifier ’) 4 Bw=100*10^3; 5 Sn=7*10^-21; 6 R=50*10^3; 7 A=(Sn*R*Bw)^0.5; 8 En=2*A; 9 disp ( E n , ’ N o i se s e v o l t a g e a t i n p u t (V)= ’ ) ; 10 G a = 1 0 0 ; 11 E n o = E n * G a ; 12 disp ( E n o , ’ N o i s e v o l t a g e a t o u tp t p u t (V)= ’ ) ;
Scilab code Exa 2.8 calculating the noise voltage
1 2 3 4 5 6 7
// c a l cu l a t in g the n oi s e v ol ta ge
clc ; disp ( ’ c a l c u l a t i n g t he he n o i s e v o l t a g e ’ ) Sn=20; Vs=3; Vn=Vs/(Sn)^0.5; disp ( V n , ’ n o i s e V o l t a g e (mV) = ’ )
15
Scilab code Exa 2.9 calculating the signal to noise ratio at input calculat-
ing the signal to noise ratio at output calculating the noise factor and noise figure 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// c a lc u la t in g the s i gn a l to n oi se r a ti o at input // c a l c u l a t i n g t h e s i g n a l t o n o i s e r a t i o a t o u t p u t / / c a l c u l a t i n g t h e n o i s e f a c t o r and n o i s e f i g u r e
clc ; disp ( ’ s i g n a l t o n o i s e r a t i o a t i n pu t ’ ) Sni=(3*10^-6/(1*10^-6))^2; disp ( S n i , ’ s i g n a l t o n o i s e r a t i o a t i np ut= ’ ) disp ( ’ s i g n a l t o n o i s e r a t i o a t o ut p u t ’ ) Sno=(60*10^-6/(20*10^-6))^2; disp ( S n o , ’ s i g n a l t o n o i s e r a t i o a t o u tp ut= ’ ) disp ( ’ New s i g n a l t o n o i s e r a t i o a t o ut pu t ’ ) Snno=(60*10^-6/(25*10^-6))^2; disp ( S n n o , ’ s i g n a l t o n o i s e r a t i o a t o ut p u t= ’ ) F=Sni/Snno; disp (F , ’ n o i s e F a ct o r= ’ ) n f = 1 0 * log10 ( F ) ; disp ( n f , ’ n o i s e F i g u r e ( dB )= ’ )
Scilab code Exa 2.10 calculating the ratio of output signal to noise signal
1 // c a l c u l a t i n g t h e r a t i o
o f output s i g n al to n oi se
signal 2 3 4 5 6 7 8 9 10
clc ; disp ( ’ The n o i s e v o l t a g e i s ’ ) Bw=100*10^3; K=1.38*10^-23; T=300; R=120; A=(K*T*R*Bw)^0.5; En=2*A; disp ( E n , ’ N o i se v o l t a g e (V)= ’ ) ;
16
11 12 13 14
Eno=0.12*10^-3; disp ( E n o , ’ N o i s e v o l t a g e a t o u tp u t (V)= ’ ) ; Ra=Eno/En; disp ( R a , ’ R a ti o o f s i g n a l v ot ag e t o N oi se v o l t a g e = ’ ) ;
Scilab code Exa 2.12 calculating the average force and range of error
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// c a l c u l a t i n g t h e a ve ra ge f o r c e and r a ng e o f e r r o r
clc ; F1=10.03; F2=10.10; F3=10.11; F4=10.08; Fav=(F1+F2+F3+F4)/4; disp ( F a v , ’ A v e r ag e F o r c e ( N) = ’ ) ; Fmax=F3; MaxR=Fmax-Fav; Fmin=F1; MinR=Fav-Fmin; AvgR=(MaxR+MinR)/2; disp ( A v g R , ’ A ve ra ge r a ng e o f e r r o r (N)= ’ )
Scilab code Exa 2.13 calculating the sum of resistances connected in se-
ries with uncertainity of one unit 1 //calculat ing
t he sum o f r e s i s t a n c e s c on ne ct ed i n s e r i e s w i t h u n c e r t a i n i t y o f o ne u n i t
2 3 4 5 6
clc ; R1=72.3; R2=2.73; R3=0.612; R=(R1+R2+R3);
17
7 disp (R , ’ sum o f r e s i s t a n c e s ( ohm ) = ’ ) ; 8 9 disp ( ’ t h e r e s u l t a n t r e s i s t a n c e i s 7 5 . 6 ohm w i t h 6 a s f i r s t doutful fi gu re ’)
Scilab code Exa 2.14 calculating the power with uncertainity of one unit
in voltage and current 1 // calculat ing
t he power w i th u n c e r t a i n i t y o f o ne u n i t i n v o l t a g e and c u r r e n t
2 3 4 5 6 7 8
clc ; V=12.16; I=1.34; P=V*I; disp (P , ’ Power (W) = ’ ) ;
disp ( ’ t h e r e s u l t a n t d o u t f ul f i g u r e ’ )
i s 1 6. 2 W with 2 a s f i r s t
Scilab code Exa 2.15 calculating the sum of resistances connected in se-
ries with appropriate number of significant figure 1 //calculat ing
t he sum o f r e s i s t a n c e s c on ne ct ed i n s e r i e s w i t h a p pr o pr i a t e number o f s i g n i f i c a n t figure
2 3 4 5 6 7 8
clc ; R1=28.7; R2=3.624; R=(R1+R2); disp (R , ’ sum o f r e s i s t a n c e s ( ohm ) = ’ ) ;
18
9 disp ( ’ t h e r e s u l t a n t
r e s i s t a n c e i s 3 2 . 3 ohm a s o ne o f t h e r e s i s t a n c e i s a cc ur a t e t o t hr ee s i g n i f i c a n t figure ’)
Scilab code Exa 2.16 calculating the voltage drop with appropriate num-
ber of significant figure 1 // c a l c u l a t i n g
t he v o l t ag e d ro p w i th a p p r o p r i a t e number o f s i g n i f i c a n t f i g u r e
2 3 4 5 6 7 8 9
clc ; R=31.27; I=4.37; E=I*R; disp (E , ’ v o l t a g e d ro p (V) = ’ ) ; disp ( ’ t h e v o l t a g e d ro p i s 1 3 7 V a s o ne o f t he
r e s i s t a n c e i s a cc ur a t e t o t hr ee s i g n i f i c a n t figure ’)
Scilab code Exa 2.17 calculating the sensitivity and deflection factor of
wheatstone bridge 1 / / c a l c ul a t i n g the
s e n s i t i v i t y and d e f l e c t i o n f a c t o r o f w he at st on e b r i d g e
2 3 4 5 6 7 8
clc ; Mo=3; Mi=7; Sen=Mo/Mi; disp ( S e n , ’ s e n s i t i v i t y (mm p e r ohm ) = ’ ) ; Df=Mi/Mo; disp ( D f , ’ d e f l e c t i o n f a c t o r ( ohm p e r mm) = ’ ) ;
19
Scilab code Exa 2.18 calculating the volume of the mercury thermometer
1 2 3 4 5 6 7
/ / c a l c u l a t i n g t h e vo lu me o f t h e m er cu ry t he rm om et er
clc ; Ac=(%pi/4)*0.25^2; disp ( A c , ’ A re a o f m e rc u ry t h er m o me t er ’ ) Lc=13.8*10^3; Vc=Ac*Lc; disp ( V c , ’ V ol um e o f m e r c u r y t h e r m o m e t e r ( mm3 ) ’ )
Scilab code Exa 2.19 calculating the maximum position deviation resis-
tance deviation 1 / / c a l c u l a t i n g t h e maximum p o s i t i o n
deviation ,
r e s i s t a n c e d e vi a t io n 2 3 4 5 6 7 8 9
clc ; Pl=0.001; FSD=320; R=10000; MDD=(Pl*FSD); disp ( M D D , ’ Maximum d i s p l a c e m e n t MRD=Pl*R; disp ( M R D , ’ Maximum d i s p l a c e m e n t
d e v i a t i o n ( d e g r e e )= ’ ) ; d e v i a t i o n ( ohm )= ’ ) ;
Scilab code Exa 2.20 calculating the dead zone
1 // c a l c u l a t i n g t he dead z on e 2 clc ; 3 disp ( ’ s p a n s= ’ )
20
4 s=600; 5 Dz=0.00125*s; 6 disp ( D z , ’ D ead z o n e ( d e g r e e C )= ’ ) ;
Scilab code Exa 2.22 calculating the Resolution
1 2 3 4 5 6 7
// c a l c u l a t i n g t he R e so l u ti o n
clc ; Fs=200; D=100; SD=Fs/D; R=SD/10; disp (R , ’ r e s o l u t i o n (V)= ’ )
Scilab code Exa 2.23 calculating the Resolution
1 2 3 4 5 6 7
// c a l c u l a t i n g t he R e so l u ti o n
clc ; Fs=9.999; D=9999; SD=Fs/D; R=SD; disp (R , ’ r e s o l u t i o n (V)= ’ )
Scilab code Exa 2.24 calculating the reading of the multimeter and per-
centage error 1 // c a l c u l a t i n g
t he r e a d i n g o f t he m ul ti me te r and p e rc e n t ag e e r r o r
2 clc ;
21
3 4 5 6 7 8 9
Zl=20000; Zo=10000; Eo=6; El=Eo/(1+Zo/Zl); disp ( E l , ’ R ea di n g o f t h e m u l t i m e te r (V)= ’ ) PE=((El-Eo)/Eo)*100; disp ( P E , ’ P e r ce n t a ge e r r o r = ’ )
Scilab code Exa 2.25 calculating the reading of the multimeter and per-
centage error 1 // c a l c u l a t i n g
t he r e a d i n g o f t he m ul ti me te r and p e rc e n t ag e e r r o r
2 3 4 5 6 7 8 9
clc ; Zl=20000; Zo=1000; Eo=6; El=Eo/(1+Zo/Zl); disp ( E l , ’ R ea di n g o f t h e m u l t i m e te r (V)= ’ ) PE=((El-Eo)/Eo)*100; disp ( P E , ’ P e r ce n t a ge e r r o r = ’ )
Scilab code Exa 2.26 calculating the loading error
1 2 3 4 5 6 7 8 9
// c a l c u l a t i n g t h e l o a d i ng e r r o r
clc ; Zl=1000; Zo=200*200/400; Eo=100*200/400; El=Eo/(1+Zo/Zl); disp ( E l , ’ R ea di n g o f t h e m u l t i m e te r (V)= ’ ) PE=((El-Eo)/Eo)*100; disp ( P E , ’ P e rc e nt a ge l o a d i n g e r r o r = ’ )
22
10 A c = 1 0 0 + P E ; 11 disp ( A c , ’ Accura cy=’ )
Scilab code Exa 2.27 calculating the voltage across the oscilloscope
1 2 3 4 5 6 7 8 9 10 11 12 13
// c a l c u l a t i n g th e v o lt a ge a c ro s s th e o s c i l l o s c o p e
clc ; C=50*10^-6; f=100000; disp (f , ’ f r e q u e n c y = ’ ) Xc=1/(2*%pi*f*C); R=10^6; Zl=(R*-%i*Xc)/(R-%i*Xc); Eo=1; Zo=10*10^3;
El=Eo/(1+Zo/Zl); disp ( E l , ’ R ea di n g o f t h e m u l t i m e te r (V)= ’ )
Scilab code Exa 2.28 calculating the actual value of current measured
value of current and percentage error 1 // c a l c u l a t i n g
t he a c t u a l v a l u e o f c ur re nt , me a s ur ed v a lu e o f c u r re n t and p e rc e n t a g e e r r o r
2 3 4 5 6 7 8 9 10
clc ;
Eo=10-((10*1000)/(1000+1000)); Zo=((1000*1000)/(1000+1000))+500; Io=Eo/Zo; disp ( I o , ’ A ct ua l v a lu e o f c u r r e nt (A)= ’ ) Zl=100; Il=Eo/(Zo+Zl); disp ( I l , ’ Me as ur ed v a l u e o f c u r r e n t (A)= ’ )
23
11 P E = ( ( I l - I o ) / I o ) * 1 0 0 ; 12 disp ( P E , ’ P e rc e nt a ge l o a d i n g e r r o r = ’ )
Scilab code Exa 2.29 calculating the maximum available power
1 2 3 4 5 6 7 8 9 10
/ / c a l c u l a t i n g t h e maximum a v a i l a b l e po we r clc ;
Eo=80*10^-3; Il=5*10^-9; Rl=6*10^6; Ro=(Eo/Il)-Rl; Pmax=(Eo^2)/(4*Ro);
disp ( P m a x , ’ Maximum a v a i l a b l e P ow er (W) = ’ )
24
Chapter 3 Errors in Measurements and Their Statistical Analysis
Scilab code Exa 3.1 calculating guarantee value of capacitance
1 2 3 4 5 6 7 8
/ / c a l c u l a t i n g g ua ra n t ee v al ue o f c a p a ci t an c e
clc ; As = 1; Er=0.05; Aau=As*(1+Er); disp ( A a u , ’ U pp er l i m i t ( m i c r o F )= ’ ) ; Aal=As*(1-Er); disp ( A a l , ’ L ow er l i m i t ( m i c r o F )= ’ ) ;
Scilab code Exa 3.2 calculating percentage limiting error
1 2 3 4 5
// c a l c u l a t i n g p e r c e n t a g e l i m i t i n g e r r o r clc ; A s = 15 0; Er=0.01; dA=As*Er;
25
6 As1=75; 7 Er=(dA/As1)*100; 8 disp ( E r , ’ P er ce nt a g e l i m i t i n g
e r r o r = ’ );
Scilab code Exa 3.3 Calculate the range of readings
1 2 3 4 5 6
/ / C a lc u l a te t h e r an ge o f r e a d i n g s
7 8 9 10
clc ; fsd=1000; TP=100; Efsd=(1/100)*1000; disp ( E f s d , ’ m ag ni tu de o f E rr o r when s p e c i f i e d i n t er ms o f f u l l s c a l e d e f l e c t i o n (w)= ’ ) disp ( ’ T hus t h e m et er w i l l r e a d b et we en 9 0W and 1 10W’ ) Etv=(1/100)*100; disp ( E t v , ’ m ag ni tu de o f E r ro r when s p e c i f i e d i n t er ms o f t r u e v a lu e (w)= ’ ) disp ( ’ T hus t h e m et er w i l l r e a d b et we en 9 9W and 1 01W’ )
Scilab code Exa 3.4 Calculate the limiting error in percent
1 2 3 4 5 6
// C a lc u l a te t h e l i m i t i n g e r r o r i n p e r c e n t
clc ; dA=0.05*5*10^-6; As=2.5*10^-6; Er=(dA/As)*100; disp ( E r , ’ p er c em ta g e l i m i t i n g
26
e r r o r =+/− ’ )
Scilab code Exa 3.5 Calculate the range of readings specified interms of
fsd and true value 1 // C a lc u l a te t h e r a ng e o f r e a d i n g s s p e c i f i e d
i nt er ms
o f f . s . d . and t r u e v a l u e 2 3 4 5 6
7 8 9 10 11 12
13 14
clc ; disp ( ’ R ange when s p e c i f i e d i n t e rm s o f f . s . d . ’ ) Error_fsd=1*1000/100’ Range_lower_value=100-Error_fsd; disp (Range_lower_value , ’ L o wer v a l u e o f r a n g e ( kN/m2 ) ’) Range_upper_value=100+Error_fsd; disp (Range_upper_value , ’ U pp er v a l u e o f r a n g e ( kN/m2 ) ’) disp ( ’ Range when s p e c i f i e d i n te r ms o f True v a lu e ’ ) Error_true=1*100/100’ Range_lower_value=100-Error_true; disp (Range_lower_value , ’ L o wer v a l u e o f r a n g e ( kN/m2 ) ’) Range_upper_value=100+Error_true; disp (Range_upper_value , ’ U pp er v a l u e o f r a n g e ( kN/m2 ) ’)
Scilab code Exa 3.6 Calculate the magnitude and limiting error in ohm
and in percentage of the resistance 1 / / C a l cu l a te t he m ag n i t u d e and l i m i t i n g
and i n p e r c e n t a g e o f t h e r e s i s t a n c e 2 3 4 5 6 7 8
clc ; R1=37; R1_le=5*R1/100; R2=75; R2_le=5*R2/100; R3=50; R3_le=5*R3/100;
27
e r r o r i n ohm
9 10 11 12 13 14
R=R1+R2+R3; disp (R , ’ V al ue o f r e s i s t a n c e ( ohm )= ’ ) R_le=R1_le+R2_le+R3_le; disp ( R _ l e , ’ L i m it i n g Va lu e o f r e s i s t a n c e ( ohm )= ’ ) Limiting_error_percentage=R_le*100/R; disp ( L i m i t i n g _ e r r o r _ p e r c e n t a g e , ’ L i m i t i n g V al ue o f r e s i s t a n c e ( p e r c e n t a g e )=+/− ’ )
Scilab code Exa 3.7 calculate the value of relative limiting error in resis-
tance 1 // c a l c u l a t e t h e v a l ue o f
r e l a t iv e l i mi t in g e rr or
i n r e s i s ta n c e 2 3 4 5 6
clc ; Re_P=1.5; Re_I=1; Re_resistance=(Re_P+2*Re_I); disp (Re_resi stance , ’ t h e v a l u e o f
r e l a t iv e l i mi t in g e r r o r o f r e s i s t a n c e i n p e r c e n t a g e (+/ −)= ’ )
Scilab code Exa 3.8 Calculate the guaranteed values of the resistance
1 2 3 4
/ / C a lc u l a te t h e g ua ra nt ee d v a l u es o f t h e r e s i s t a n c e clc ; R1=100; R1_le_perunit=0.5; // R 1 l e p e r u n i t
i n d i c a t e s dR1/R1
= 0.5% 5 6 7 8 9 10
R2=1000; R2_le_perunit=0.5; R3=842; R3_le_perunit=0.5; Rx=R2*R3/R1; disp ( R x , ’ V al ue o f r e s i s t a n c e ( ohm )= ’ )
28
11 R x _ l e _ p e r u n i t = R 1 _ l e _ p e r u n i t + R 2 _ l e _ p e r u n i t + R3_le_perunit; 12 13 disp (Rx_le_p erunit , ’ L i mi m i t in i n g V a l u e o f r e s i s t a n c e p er er u n i t ( d Rx Rx / Rx Rx ) = ’ ) 14 E r _ L e = R x _ l e _ p e r u n i t * R x / 1 0 0 ; 15 disp ( E r _ L e , ’ L i m i t i n g V al a l ue u e o f r e s i s t a n c e ( oh ohm )= )=+/− ’ ) 16 disp ( ’ G ua u a ra r a nt n t ee e e v a lu l u e o f t he h e r e s i s t a n c e ( oh ohm )= )= ’ ) 17 G 1 = R x + E r _ L e ; 18 G 2 = R x - E r _ L e ; 19 disp ( G 1 , G 2 , ’ ’ )
Scilab code Exa 3.9 Calculate the percentage limiting error and range of
resistance values 1 / / C a lc l c u l a te te th e p er ce nt ag e l i m i t i n g
e r r o r a n d r an a n ge ge
o f r e s i s ta n c e v al ue s 2 clc ; 3 disp ( ’ d ec e c aad d e a i s s e t a t 4 00 0 0 0 ohm , s o , e r r o r i n d e c a d e a= ’ ) 4 Er_a=4000*0.1/100; 5 disp ( E r _ a ) 6 disp ( ’ d ec e c aad d e b i s s e t a t 6 0 0 ohm , s o , e r r o r i n d ec e c aad de b= ’ ) 7 Er_b=600*0.1/100; 8 disp ( E r _ b ) 9 disp ( ’ d ec e c aad d e c i s s e t a t 3 0 ohm , s o , e r r o r i n d ec e c a de de c= ’ ) 10 E r _ c = 3 0 * 0 . 1 / 1 0 0 ; 11 disp ( E r _ c ) 12 disp ( ’ d ec e c aad d e d i s s e t a t 9 ohm , s o , e r r o r i n d ec e c aad de d =’) 13 E r _ d = 9 * 0 . 1 / 1 0 0 ; 14 disp ( E r _ d ) 15 E r _ t o t a l = E r _ a + E r _ b + E r _ c + E r _ d ;
29
16 R e _ l e _ p e r c e n t a g e = E r _ t o t a l * 1 0 0 / 4 6 3 9 ; 17 disp (Re_ le_percentage , ’ P eerr c en e n t ag ag e R e l a t i v e l i m i t i n g error=’) 18 R a n g e _ l o w e r = 4 6 3 9 - E r _ t o t a l ; 19 disp (Range_lower , ’ L ow o w e r v a l u e o f r a ng n g e ( oh ohm )= )= ’ ) 20 R a n g e _ u p p e r = 4 6 3 9 + E r _ t o t a l ; 21 disp (Range_upper , ’ u p pe p e r v a l u e o f r a n g e ( oh ohm )= )= ’ )
Scilab code Exa 3.10 Calculate the magnitude of power and limiting error
1 / / C a l c u l a te t e t he h e m ag a g ni n i tu t u de de o f p o w e r a n d l i m i t i n g
error 2 3 4 5 6 7 8 9 10 11 12 13 14 15
clc ; F=4.58; L=397; R=1202*10^-9; t=60; P=(2*%pi*9.81*F*L*R)/(t*10^6); disp ( P , ’ M a g n i t u de d e o f p o w er e r (W) = ’ ) d F _ p u = 0 . 0 2 / F ; // / / p e r u ni ni t e r r o r i n f o r c e d L _ p u = 1 . 3 / L ; // // p e r u n i t e r r o r i n L e n g t h d R _ p u = 1 / R ; // / / p e r u ni ni t e r ro r i n r e vo l u t i on d t _ p u = 0 . 5 / t ; // // p e r u n i t e r r o r i n t i m e d P _p _ p u = d F _p _p u + d L _ p u + d R _p _p u + d t _ p u ; dP_le=dP_pu*P; disp ( d P _ l e , ’ M a gn g n iitt u de d e o f l i m i t i n g e r r o r i n p o w e r (W) ’)
Scilab code Exa 3.11 Calculate the magnitude of Force and limiting error
1 / / C a l cu c u l a te t e t he h e m ag a g n i t u d e o f F or o r ce ce and l i m i t i n g
error 2 clc ;
30
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
E=200*10^9; L=25*10^-3; b=4.75*10^-3; d=0.9*10^-3; I=(b*d^3)/12; x=2.5*10^-3; F=(3*E*I*x)/(L^3); disp ( F , ’ M ag a g n it i t ud u d e o f F o r c e ( N )= ’ ) d E _ p u = 0 / E ; // / / p e r u n it it e r r o r i n E db_pu=0.0075/b; dd_pu=0.0075/d; dx_pu=0.025/x; dL_pu=0.025/L; d F _p _ p u = ( d E _ pu p u + d b _ p u + 3 * d d _p _ p u + d x _ pu p u + 3 * d L _ p u ) * 10 10 ^ - 3 ;
disp ( d F _ p u , ’ l i m i t i n g
e r r o r i n f o r c e ( N ) =+/− ’ )
Scilab code Exa 3.12 calculate the power loss and relative error
1 2 3 4 5 6 7 8
/ / c a l c u l a t e t h e p o wer l o s s and r e l a t i v e e r r o r
clc ; I=64*10^-3; R=3200; P=(I^2)*R; disp ( P , ’ Power (W)= ’ ) Re=2*0.75+0.2; disp ( R e , ’ R e l a t i v e e r r o r (%) = ’ )
Scilab code Exa 3.13 Calculate the true power as a percentage of mea-
sured power 1 / / C a l cu c u l a te t e t he h e t r ue u e p o w e r a s a p e rc rc en t ag e o f
m e a s ur u r e d p o we we r 31
2 3 4 5 6 7 8 9 10
clc ; I=30.4; R=0.015; I_true=I*(1+0.012); R_true=R*(1-0.003); P_true=(I_true^2)*R_true; P_measured=(I^2)*R; R=P_true*100/P_measured; disp (R , ’ t r u e p ower a s a p e r c e n t a g e o f m ea su re d p ower (%)=’ )
Scilab code Exa 3.14 calculate the total resistance error of each register
and fractional error of total resistance 1 / / c a l c u l a t e th e t o t a l
r e s i st a n ce , e r r o r o f each r e g i s t e r and f r a c t i o n a l e r r o r o f t o t a l r e s i s t a n c e
2 3 4 5 6 7 8 9 10 11 12 13 14
15 16 17
clc ; R1=250; R2=500; R3=375; R_true=1/((1/R1)+(1/R2)+(1/R3)); disp (R_true , ’ True v a l u e o f r e s i s t a n c e ( ohm )= ’ ) d R 1 = 0 . 0 25 * R 1 ; dR2=-0.36*R2; dR3=0.014*R3; R1_effective=R1+dR1; R2_effective=R2+dR2; R3_effective=R3+dR3; R_effective=1/((1/R1_effective)+(1/R2_effective)+(1/ R3_effective)); disp (R_effective , ’ E f f e c t i v e v a l u e o f r e s i s t a n c e ( ohm )= ’ ) Fractional_error=(R_true-R_effective)/R_true; disp (Fra ctional_error , ’ F r a c t i o n a l e r r o r ’ )
32
Scilab code Exa 3.15 find the error
1 // 2 clc ; 3 disp ( ’ When a l l
t h e c om po ne nt s h av e 0% e r r o r t he n r e s o n a n t f r e q u e n cy ( Hz ) ’ )
4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21
L=160*10^-6; C=160*10^-12; fr=[1/(2*%pi)]*[1/(L*C)]^0.5; disp ( f r ) disp ( ’ When a l l t h e c om po ne nt s h av e +10% e r r o r t h en r e s o n a n t f r e q u e n cy ( Hz ) ’ ) L_new=(160*10^-6)+0.1*L; C_new=(160*10^-12)+0.1*C; fr_new=[1/(2*%pi)]*[1/(L_new*C_new)]^0.5; disp ( f r _ n e w ) error = ( f r _ n e w - f r ) / f r ; disp ( error , ’ e r r o r = ’ ) disp ( ’ When a l l t h e c om po ne nt s h av e −10% e r r o r t h en r e s o n a n t f r e q u e n cy ( Hz ) ’ ) L_new =(160*10^ -6) -0.1*L; C _ n e w = ( 1 6 0 * 1 0 ^ - 1 2 ) - 0 .1 * C ; fr_new=[1/(2*%pi)]*[1/(L_new*C_new)]^0.5; disp ( f r _ n e w ) error = ( f r _ n e w - f r ) / f r ; disp ( error , ’ e r r o r = ’ )
Scilab code Exa 3.16 calculate the Volume and relative error
1 // c a l c u l a t e t he V olume and r e l a t i v e 2 clc ; 3 L=250;
33
error
4 5 6 7 8
d=50; V=((%pi/4)*d^2)*L; disp (V , ’Volume(mm3)=’ ) Re=2*0.2-0.5; disp ( R e , ’ R e l a t i v e e r r o r (%)= ’ )
Scilab code Exa 3.17 calculate the per unit change in the value of spring
for different temperature ranges 1 // c a l c u l a t e t h e p e r u n i t c h a n g e i n t h e v al ue o f
s p r i n g f o r d i f f e r e n t t em pe ra tu re r an g e s 2 3 4 5
6 7 8 9
10 11 12
clc ; dG_pu=-240*10^-6; dD_pu=11.8*10^-6; disp ( ’ f o r t em p er at u re c ha ng e o f 20 d e g re e C t o 50 degree C (%) =’ ) d_th=30; dK_pu=(dG_pu+dD_pu)*d_th*100; disp ( d K _ p u ) disp ( ’ f o r t em p er at u re c ha ng e o f 20 d e g re e C t o −50 degree C (%) =’ ) d_th=-70; dK_pu=(dG_pu+dD_pu)*d_th*100; disp ( d K _ p u )
Scilab code Exa 3.18 Calculate apparent resistance actual resistance and
error 1 / / C a lc u l a te a pp ar en t r e s i s t a n c e ,
and e r r o r 2 clc ; 3 Et=100; 4 It=5*10^-3;
34
a c tu a l r e s i s t a n c e
5 6 7 8 9 10 11
Rt=Et/It; disp ( R t , ’ a pp a re nt v a lu e o f r e s i s t a n c e ( ohm )= ’ ) Rv=1000*150; Rx=Rt*Rv/(Rv-Rt); disp ( R x , ’ t r u e v a lu e o f r e s i s t a n c e ( ohm ) ’ ) Er_percentage=[(Rt-Rx)/Rx]*100; disp (Er_perc entage , ’ p e r c e n t a g e e r r o r = ’ )
Scilab code Exa 3.19 Calculate apparent resistance actual resistance and
error 1 / / C a lc u l a te a pp ar en t r e s i s t a n c e ,
a c tu a l r e s i s t a n c e
and e r r o r 2 3 4 5 6 7 8 9 10 11
clc ; Et=40; It=800*10^-3; Rt=Et/It; disp ( R t , ’ a pp a re nt v a lu e o f r e s i s t a n c e ( ohm )= ’ ) Rv=1000*150; Rx=Rt*Rv/(Rv-Rt); disp ( R x , ’ t r u e v a lu e o f r e s i s t a n c e ( ohm ) ’ ) Er_percentage=[(Rt-Rx)/Rx]*100; disp (Er_perc entage , ’ p e r c e n t a g e e r r o r = ’ )
Scilab code Exa 3.20 Calculate the error and percentage error in the mea-
surement of deflection 1 / / C a l cu l a t e t he e r r o r and p e rc e nt a g e e r r o r i n t he
mea surement o f d e f l e c t i o n 2 3 4 5
clc ; l=0.2; E=200*10^9; b=20*10^-3;
35
6 7 8 9 10 11 12 13 14 15 16
d=5*10^-3; D=(4*l^3)/(E*b*d^3); F=1*9.81; x _t r ue = D * F ; disp (x_true , ’ True v al ue o f d e f l e c t i o n ’ ) x_indicated=D*10.31/(1+.1*D); disp (x_indicated , ’ I n d i c a t e d v al ue o f d e f l e c t i o n ’ ) Er= x_indicated -x_true ; disp ( E r , ’ e r r o r = ’ ) Er_percentage=Er*100/x_true; disp (Er_perc entage , ’ P e r ce n t ag e e r r o r = ’ )
Scilab code Exa 3.21 to find the mean deviations from the mean Average
deviation standard deviation and variance 1 / / t o f i n d t h e mean , d e v i a t i o n s f ro m t h e mean , A ve ra g e
d e v ia t i o n , s ta n da r d d e v i a t i o n and v a r i a n c e 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
clc ; x = [ 53 2 5 48 5 43 5 35 5 46 5 31 5 43 5 36 ]; X = sum ( x ) ; n=8; a=0; Mean=X/n; disp ( X / n , ’ mean (kHZ) ’ ) ; for i = 1 : n , d(i)=x(i)-Mean disp ( d ( i ) , ’ d e v i a t i o n s = ’ ) a = a + ( abs ( d ( i ) ) ) end d_average=a/n; disp (d_average , ’ A ve ra g e d e v i a t i o n ( kHz )= ’ ) d _ 2 = sum ( d ^ 2 ) ; s = sqrt ( d _ 2 / ( n - 1 ) ) disp (s , ’ s t a n d a r d d e v i a t i o n ( kHz ) ’ ) ;
36
20 V = s ^ 2 ; 21 disp (V , ’ v a r a i n c e ( kHZ ) 2= ’ )
Scilab code Exa 3.22 to find the mean standard deviation probable error
and range 1 //to find
t h e mean , s t a nd a r d d e v i a t i o n , p r o b a b le e r r o r and r an ge
2 3 4 5 6 7 8 9 10 11 12 13 14 15
clc ; x = [ 41 .7 42 4 1. 8 42 4 2. 1 4 1. 9 4 2 4 1. 9 4 2. 5 4 1. 8] ; X = sum ( x ) ; disp ( X ) ; d = [ - .2 7 . 03 - .1 7 . 03 . 13 -.0 7 . 03 - .07 . 53 - .1 7] ; d _ 2 = sum ( d ^ 2 ) ; n=10; disp ( X / n , ’ m ean l e n g t h ( d e g C ) ’ ) ; disp ( sqrt ( d _ 2 / n ) , ’ s t a nd a r d d e v i a t i o n ( i f d at a i s i n f i n i t e ) ( deg C) ’ ) ; disp ( sqrt ( d _ 2 / ( n - 1 ) ) , ’ s t a n d a r d d e v i a t i o n ( d eg C) ’ ) ; r 1 = . 6 7 4 5 * sqrt ( d _ 2 / ( n - 1 ) ) ; disp ( r 1 , ’ p r ob a b le e r r o r o f 1 r e a di n g ( deg C) ’ ) ; disp ( r 1 / sqrt ( n - 1 ) , ’ p r o b a b l e e r r o r o f mean ( d eg C) ’ ) ; disp ( max ( x ) - min ( x ) , ’ ra ng e ( deg C) ’ ) ;
Scilab code Exa 3.23 to find the arithematic mean maen deviation stan-
dard deviation prpobable error of 1 reading standard deviation and probable error of mean standard deviation of standard deviation 1 //to find
t h e a r i t h e m a t i c mean , maen d e v i a t i o n , s ta n d ar d d e vi a t i o n , p rp ob ab le e r r o r o f 1 r ea di ng , s t an d ar d d e v i a t i o n and p r ob a b le e r r o r o f mean , s ta n d ar d d e v i a t i o n o f s ta n d ar d d e v i a t i o n
2
37
3 4 5 6 7 8 9 10
11 12 13 14
clc ; T = [ 39 7 3 98 3 99 4 00 4 01 4 02 4 03 4 04 4 05 ]; f =[1 3 12 23 37 16 4 2 2]; Tf = sum ( abs ( T . * f ) ) ; disp ( T f / sum ( f ) , ’mean temp( deg C) ’ ) ; d = [ - 3 .7 8 - 2. 78 - 1. 78 - .7 8 . 22 1 .2 2 2 .2 2 3 .2 2 4 . 22 ]; disp ( sum ( f . * d ) /sum ( f ) , ’ mean d e v i a t i o n ( d eg C ) ’ ) ; disp ( sqrt ( sum ( f . * d ^ 2 ) / sum ( f ) ) , ’ s t a nd a r d d e v i a t i o n ( deg C) ’ ); disp (.6745* sqrt ( sum ( f . * d ^ 2 ) / sum ( f ) ) , ’ p r o ba b le e r r o r o f 1 r e a d i n g ( d eg C) ’ ) ; disp ((.6745* sqrt ( sum ( f . * d ^ 2 ) / sum ( f ) ) ) / sqrt ( sum ( f ) ) , ’ p r o b a b le e r r o r o f mean ( d eg C) ’ ) ; disp (( sqrt ( sum ( f . * d ^ 2 ) / sum ( f ) ) ) / sqrt ( sum ( f ) ) , ’ s t a nd a r d d e v i a t i o n o f mean ( d eg C) ’ ) ; disp (( sqrt ( sum ( f . * d ^ 2 ) / sum ( f ) ) ) / sqrt ( sum ( f ) * 2 ) , ’ s ta n da r d d e v i a t i o n o f s ta n da r d d e v i a t i o n ( d eg C) ’ ) ;
Scilab code Exa 3.24 to find probable no of resistors
1 2 3 4 5 6 7
/ / t o f i n d p r o b a bl e no o f r e s i s t o r s
clc ; x=.15; o=.1; t=x/o; A=.4432
// dev iat ion // s t a nd a r d d e v i a t i o n // a r ea u nd er g a u s s i an c ur ve c o r r es p o n d i ng
to t 8 n=2*A*1000; 9 disp ( floor ( n ) , ’ n o o f
r e s i s t o r s ’ );
Scilab code Exa 3.25 to find no of 100 rsding exceed 30mm
38
1 2 3 4 5 6 7 8
// t o f i n d no o f 1 00 r s d i n g e xc ee d 30mm
clc ; x=30-26.3; / /mean v a l u e 2 6 . 3 r=2.5; o=r/.6745; t=x/o; A = . 3 4 1 3 ; // a r ea u nd er g a u s s i an c ur ve c o r r es p o n d i ng t o
t 9 n=2*A*100; 10 n n = 1 0 0 - floor ( n ) ; 11 disp ( n n / 2 , ’ no o f r e a d i n g s e xc ee d ’ ) ;
Scilab code Exa 3.26 to find no of rods of desired length
1 2 3 4 5 6 7 8 9 10 11 12 13
/ / t o f i n d no o f r od s o f d e s i r e d l e n g t h
clc ; n=25000; // no o f r o d s n 1 = 1 2 5 0 0 ; / / l e n g t h >10mm n2=2000; // len gth >10.25 a = n 1 - n 2 ; //10 < l e n g t h < 1 0 . 2 5 p=a/n; t=1.41; // using p t1=t*2; p1=.4975; b = p 1 * n ; / / 9 . 5 < l e n g t h <10 disp ( a + floor ( b ) , ’ t o t a l no o f r od s ’ ) ;
Scilab code Exa 3.27 to find standard deviation and probability of error
1 / / t o f i n d s ta nd ar d d e v i a t i o n and p r o b a b i l i t y
error 39
of
2 3 4 5 6 7 8 9 10 11 12
clc ; p=.2; x=.8; t=.5025; sd=x/t; disp ( s d , ’ s t n da r d d e v i a t i o n ’ ) ; x=1.2; t=x/sd; p=2*.2743; disp (p , ’ p r o b a b i l i t y o f e r r o r ’ ) ;
Scilab code Exa 3.28 to find no of expected readings
1 2 3 4 5 6 7 8 9 10
// t o f i n d no o f e xp ec te d r e a d i n g s
clc ; x=20; h=0.04; s d = 1 / ( sqrt ( 2 ) * h ) ; t=x/sd;
P=.3708; disp ( ceil ( 2 * P * x ) , ’ no o f e xp ec te d r e a d i n g s ’ ) ;
Scilab code Exa 3.29 to calculate precision index of instrument
1 2 3 4 5 6
// t o c a l c u l a t e p r e c i s i o n i nd ex o f i ns tr um en t clc ; t=.675; x=2.4; sd=x/t;
40
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
h = 1 / ( sqrt ( 2 ) * s d ) ; disp (h , ’ p r e c i s i o n i n de x ’ ) ; t=(50-44)/sd; p=.45; n=8*30; / / s e p t month n o o f m e as u re m en t s a=((.5-p)*n); disp (a , ’ no o f f a l s e a la rm s ’ ) ;
rn=a/2; // r ed uc ed n o o f f a l s e p1=rn/n; P=.5-p1; t=1.96; sd=(50-44)/t; h = 1 / ( sqrt ( 2 ) * s d ) ; disp (h , ’ p r e c i s i o n i n de x ’ ) ;
a la rm s
Scilab code Exa 3.30 to find confidence interval for given confidence levels
1 / / to f i nd
c o n f i d e n ce i n t e r v a l f o r g i v en c o n f i d e n ce
levels 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
clc ; c l =[ .5 . 9 . 95 . 99 ]; s=.22; d = [ .7 1 .8 3 2 .2 6 3 .2 5] ; function [ a ] = c i ( b ) a=s*b; endfunction
CI(1)=ci(d(1)); CI(2)=ci(d(2)); CI(3)=ci(d(3)); CI(4)=ci(d(4));
disp ( C I , ’ c o n f id e n c e i n t e r v a l ’ ) ;
41
Scilab code Exa 3.31 to point out the reading that can be rejected by
chavenets criterion 1 / / t o p o in t o u t t he r e ad i ng t ha t can be r e j e c t e d by
c ha ve ne ts c r i t e r i o n 2 3 clc ; 4 x = [ 5. 3 5 .7 3 6 .7 7 5 .2 6 4 .3 3 5 .4 5 6 .0 9 5 .6 4 5 .8 1 5.75]*10^-3; 5 d = [ - . 31 3 . 11 7 1 .1 57 - .3 53 - 1. 28 3 - .1 63 . 47 7 . 02 7 . 1 97 . 1 37 ] * 10 ^ - 3 ; 6 n=10; 7 X = sum ( x ) / n ; 8 s = sqrt ( sum ( d ^ 2 ) / ( n - 1 ) ) ; 9 a = abs ( d ) / s ; disp ( a ) ; 10 11 12 for i = 1 : 1 0 , 13 14 if a ( i ) > 1 . 9 6 then disp ( x ( i ) , ’ r e j e c t e d v a lu e ’ ) ; 15 16 end end 17
Scilab code Exa 3.32 calculate standard deviation
1 2 3 4 5
/ / c a l c u l a t e s t an d ar d d e v i a t i o n clc ; x = [ .9 2 .3 3 .3 4 .5 5 .7 6 .7 ]; y = [1 .1 1.6 2.6 3.2 4 5];
42
6 n=6; 7 a = ( ( n * sum ( x . * y ) - ( sum ( x ) * sum ( y ) ) ) / ( ( sum ( x ^ 2 ) * n ) -sum ( x )^2)); 8 b = ( ( sum ( y ) * sum ( x ^ 2 ) - ( sum ( x ) * sum ( x . * y ) ) ) / ( ( sum ( x ^ 2 ) * n ) - sum ( x ) ^ 2 ) ) ; 9 10 s d y = sqrt ( ( 1 / n ) *sum ( ( a * x + b - y ) ^ 2 ) ) ; 11 s d x = s d y / a ; 12 13 sa = sqrt ( n / ( n * sum ( x ^ 2 ) -sum ( x ) ^ 2 ) ) * s d y ; 14 sb = sqrt ( sum ( x ^ 2 ) / ( n *sum ( x ^ 2 ) -sum ( x ) ^ 2 ) ) * s d y ; 15 disp ( s a , ’ s a ’ ) ; 16 disp ( s b , ’ s b ’ ) ;
Scilab code Exa 3.34 determine value of total current considering errors
as limiting errors ans as standrd deviations 1 / / d et er mi ne v a l u e o f t o t a l
c u rr e nt c o n s i d e r i n g e r r o r s a s l i m i t i n g e r r o r s a n s a s s ta nd rd deviations
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
clc ; I1=200; I2=100; dI1=2; dI2=5; I=I1+I2; dI=((I1/I)*(dI1/I1)+(I2/I)*(dI2/I2)); disp ( ’ e r r o r c o ns i d e r ed a s l i m i t i n g e r r o r s ’ ) ; disp (I , ’ I ’ ) ; disp ( d I * I , ’ dI ’ ) ; s d I = sqrt ( d I 1 ^ 2 + d I 2 ^ 2 ) ; disp ( ’ e r r o r c o n s i d e r e d a s s ta nd a r d d e v i a t i o n s ’ ) ; disp (I , ’ I ’ ) ; disp ( s d I , ’ s d I ’ ) ;
43
Scilab code Exa 3.35 determine probable error in the computed value of
resistnce 1 // d et er m in e p r ob a b le e r r o r
i n t he computed v a lu e o f
resistnce 2 3 4 5 6 7 8 9 10 11
clc ; r_V=12; I=10; r_Rv=r_V/I; V=100; r1=2; r_Ri=V*r1/I^2; r _ R = sqrt ( r _ R v ^ 2 + r _ R i ^ 2 ) ; disp ( r _ R , ’ r R ’ ) ;
Scilab code Exa 3.37 to find Cq and its possible errors
1 2 3 4 5 6 7 8 9 10 11 12 13
/ / t o f i n d Cq and i t s
possible errors
clc ; d=12.5; A=(%pi/4)*d^2*10^-6; W=392; t=600; p=1000; g=9.81; h=3.66; C q = W / ( t * p * A * sqrt ( 2 * g * h ) ) ; disp ( C q , ’ Cq ’ ) ; dW=.23/W;
44
14 15 16 17 18 19 20 21 22 23 24
dt=2/t; dp=.1/100; dA=2*.002; dg=.1/100; dh=.003/h; dd=.002; dCq=Cq*(dW+dt+dp+dA+dg/2+dh/2); disp ( d C q * 1 0 0 / C q , ’ %age a b s o l u t e e r r o r ’ ) ;
s d C q = C q * sqrt ( d W ^ 2 + d t ^ 2 + d p ^ 2 + 4 * d d ^ 2 + . 2 5 * ( d g ^ 2 + d h ^ 2 ) ) ; disp ( s d C q * 1 0 0 / C q , ’ %age s t an d ar d d e v i a t i o n e r r o r ’ ) ;
Scilab code Exa 3.38 calculate power disipated and uncertaainity in power
1 // c a l c u l a t e power d i s i p a t e d and u n c e r t a a i n i t y i n
power 2 3 4 5 6 7 8 9 10
clc ; V=110.2; I=5.3; P = V * I ; disp (P , ’ p ow er (W) d i s s i p a t e d ’ ) ; w_v=.2; w_i=0.06; dp = sqrt ( ( w _ v * I ) ^ 2 + ( w _ i * V ) ^ 2 ) ; disp ( d p * 1 0 0 / P , ’ u n c e r t a i n i t y i n p ow er (%) ’ ) ;
Scilab code Exa 3.39 to find uncertainity in combined resistance in both
series and in parrallel 1 // t o f i n d
u n c e r t a i n i t y i n co mbi ned r e s i s t a n c e i n b o t h s e r i e s and i n p a r r a l l e l
2 3 clc ;
45
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
R1=100; R2=50; wR1=.1; wR2=0.03; disp ( ’ s e r i e s conn ’ ) ; R = R 1 + R 2 ; disp (R , ’ r e s i s t a n c e ( ohm ) ’ ) ; dR1=1; dR2=1; wR = sqrt ( ( d R 1 * w R 1 ) ^ 2 + ( d R 2 * w R 2 ) ^ 2 ) ; disp ( w R , ’ u n c e r t a i n i t y i n r e s i s t a n c e ( ohm ) ’ ) ;
disp ( ’ p a r r a l l e l co nn ’ ) ; R = R 1 * R 2 * ( R 1 + R 2 ) ^ - 1 ;disp (R , ’ r e s i s t a n c e ( ohm ) ’ ) ; dR1=(R2/(R1+R2))-((R1*R2)/(R1+R2)^2); dR2=(R1/(R1+R2))-((R1*R2)/(R1+R2)^2); wR = sqrt ( ( d R 1 * w R 1 ) ^ 2 + ( d R 2 * w R 2 ) ^ 2 ) ; disp ( w R , ’ u n c e r t a i n i t y i n r e s i s t a n c e ( ohm ) ’ ) ;
Scilab code Exa 3.40 to calculate uncertainity in measurement
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/ / t o c a l c u l a t e u n c e r t a i n i t y i n meas urem ent
clc ; l=150; dl=0.01; b=50; wA=l*dl; disp ( ’ when no u n c e r t a i n i t y i n measu rement o f l e n g th ’ ); disp ( w A , ’ u n c e r t a i n i t y i n m ea su re me nt o f a r e a (m∗m) ’ ) ;
disp ( ’ when no c e r t a i n i t y i n meas urement o f l e n g th ’ ) ; wA=1.5*1.5; wB=0.01; wL = sqrt ( ( w A ^ 2 - ( l * w B ) ^ 2 ) / b ^ 2 ) ;
46
15 disp ( w L , ’ u n c e r t a i n i t y
i n m ea su re me nt o f l e n g t h (m) ’ ) ;
Scilab code Exa 3.41 to calculate uncertainity in power
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/ / t o c a l c u l a t e u n c e r t a i n i t y i n power
clc ; E=100; dE=.01; I=10; dI=0.01; R=10; dR=.01; dP = sqrt ( 4 * d E ^ 2 + d R ^ 2 ) * 1 0 0 ; //P=Eˆ2/R disp ( d P , ’ %age u n c e r t a i n i t y i n p ow er m ea su re me nt ’ ) ;
dP = sqrt ( d E ^ 2 + d I ^ 2 ) * 1 0 0 ; disp ( d P , ’ %age u n c e r t a i n i t y
47
//P=E∗ I i n p ow er m ea su re me nt ’ ) ;
Chapter 4 Dynamic Characteristics of Instruments and Measurement systems
Scilab code Exa 4.1 calculating the temperature
1 2 3 4 5 6 7
// c a l c u l a t i n g t he t em pe ra tu re a f t e r 1 . 5 s
clc ; th0=100; t=1.5; tc=3.5; t h = t h 0 * [ 1 - exp ( - t / t c ) ] ; disp ( t h , ’ t em pe ra t ur e a f t e r
1 . 5 s ( d e g re e C) ’ )
Scilab code Exa 4.2 calculate time to read half of the temperature differ-
ence 1 / / c a l c u l a t e t i m e t o r e ad h a l f o f t h e t em pe ra tu re
difference 2 clc ;
48
3 4 5 6 7
tc=10/5; th=1; th0=2; t = - t c * log ( 1 - ( t h / t h 0 ) ) ; disp (t , ’ Time t o r ea d h a l f o f t he t em pe ra tu re dif fer enc e ( s ) ’ )
Scilab code Exa 4.4 Calculate the temperature after 10s
1 2 3 4 5 6 7 8
// C a l cu l a te t he t em pe ra tu re a f t e r 10 s
clc ; th0=25; thi=150; t=10; tc=6; t h = t h 0 + ( t h i - t h 0 ) * [exp ( - t / t c ) ] ; disp ( t h , ’ t he t em p er a tu re a f t e r 10 s ( d e g re e C) ’ )
Scilab code Exa 4.5 Calculate the value of resistance after 15s
1 2 3 4 5 6 7 8
/ / C a l c u l a t e t h e v al ue o f r e s i s t a n c e a f t e r 15 s
clc ; R0=29.44; Rs=100; t=15; tc=5.5; R _ 1 5 = R s + R 0 * [ 1 -exp ( - t / t c ) ] ; disp ( R _ 1 5 , ’ v a l u e o f r e s i s t a n c e
a f t e r 15 s ( ohm ) ’ )
Scilab code Exa 4.6 Calculate the depth after one hour
49
1 2 3 4 5 6 7 8 9 10 11 12 13
/ / C a l cu l a te t he d e p t h a f t e r on e h o u r
clc ; Qm=0.16*10^-3; Hin=1.2; K1=Qm/(Hin)^0.5; Qo=0.2*10^-3; Ho=(Qo/K1)^2; R=Hin/Qm; C=0.1; tc=R*C; t=3600; H = H o + ( H i n - H o ) *exp ( - t / t c ) ; disp (H , ’ t h e d ep th a f t e r o ne h ou r (m) ’ )
Scilab code Exa 4.8 Calculate time constant
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/ / C a l c u l a t e t im e c o n s t a n t
clc ; S=3.5; Ac=(%pi/4)*(0.25)^2; alpha=0.18*10^-3; Vb=S*Ac/alpha; disp ( V b , ’ v o l u me o f b u l b ( mm2 ) ’ )
Rb=[(Vb/%pi)*(3/4)]^(1/3); Ab=4*%pi*Rb^2; D=13.56*10^3; s=139; H=12; tc=(D*s*Vb*10^-9)/(H*Ab*10^-6); disp ( t c , ’ t i me c o n s t a n t ( s ) ’ )
Scilab code Exa 4.9 Calculate the temperature after 10s
50
1 2 3 4 5
/ / C a l cu l a te t he t im e c o ns t an t
ess=5; A=0.1; tc=ess/A; disp ( t c , ’ t i m e c o n s t a n t ( s ) ’ )
Scilab code Exa 4.10 Calculate the temperature at a depth of 1000 m
1 2 3 4 5 6
/ / C a l cu l a te t he t em pe ra tu re a t a d ep t h o f 1 0 0 0 m clc ; th0=20; t=2000; thr=th0 -0.005*( t-50) -0.25*exp ( - t / 5 0 ) ; disp ( t h r , ’ t em p er at u re a t a d ep th o f 1 00 0 m ( d e gr e e C ) ’)
Scilab code Exa 4.11 Calculate the value of resistance at different values
of time 1 // C a l c u l a t e t h e v al ue o f r e s i s t a n c e a t
different
v a l u e s o f t im e 2 3 4 5 6 7 8 9 10 11 12 13
clc ; Gain=0.3925; T=75; p_duration=Gain*T; tc=5.5; Rin=100; t=1; R t = p _ d u r a t i o n * ( 1 -exp ( - t / t c ) ) + R i n ; disp ( R t , ’ V al ue o f r e s i s t a n c e a f t e r 1 s ( ohm )= ’ ) t=2; R t = p _ d u r a t i o n * ( 1 -exp ( - t / t c ) ) + R i n ; disp ( R t , ’ V al ue o f r e s i s t a n c e a f t e r 2 s ( ohm )= ’ )
51
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
t=3; R t = p _ d u r a t i o n * ( 1 -exp ( - t / t c ) ) + R i n ; disp ( R t , ’ V al ue o f r e s i s t a n c e a f t e r 3 s ( ohm )= ’ ) R_inc=Rt-Rin; t=5; R t = ( R _ i n c ) * [ exp ( - ( t - 3 ) / ( 5 . 5 ) ) ] + R i n ; disp ( R t , ’ V al ue o f r e s i s t a n c e a f t e r 5 s ( ohm )= ’ ) t=10; R t = ( R _ i n c ) * [ exp ( - ( t - 3 ) / ( 5 . 5 ) ) ] + R i n ; disp ( R t , ’ V al ue o f r e s i s t a n c e a f t e r 10 s ( ohm )= ’ ) t=20; R t = ( R _ i n c ) * [ exp ( - ( t - 3 ) / ( 5 . 5 ) ) ] + R i n ; disp ( R t , ’ V al ue o f r e s i s t a n c e a f t e r 20 s ( ohm )= ’ ) t=30; R t = ( R _ i n c ) * [ exp ( - ( t - 3 ) / ( 5 . 5 ) ) ] + R i n ; disp ( R t , ’ V al ue o f r e s i s t a n c e a f t e r 30 s ( ohm )= ’ )
Scilab code Exa 4.12 calculate the value of damping constant and fre-
quency of damped oscillations 1 / / c a l c u l a t e t he v a l u e o f damping c o n s ta n t and
fr eq ue nc y o f damped o s c i l l a t i o n s 2 3 4 5 6 7 8
9 10 11
clc ; M=8*10^-3; K=1000; wn=(K/M)^0.5; disp ( ’ f o r c r i t i c a l l y damped syst em et a=1 ’ ) B=2*(K*M); disp (B , ’ D am pi ng c o n s t a n t f o r c r i t i c a l l y d am pe d s y s t e m ( N/ ms − 1)=’ ) eta=0.6; wd=wn*(1-eta^2)^0.5; disp ( w d , ’ f r e q u e n c y o f d am pe d o s c i l l a t i o n s ( r a d / s ) = ’ )
52
Scilab code Exa 4.13 Calculate damping ratio natural frequency frequency
of damped oscillations time constant and steady state error for ramp signal 1 // C a l c u l a te damping r a t i o ,
n a t u r a l f re qu en c y , f r e q ue n c y o f damped o s c i l l a t i o n s , t i me c o n s ta n t 2 / / and s te ad y s t a t e e r r o r f o r ramp s i g n a l o f 5V/ s 3 4 5 6 7 8 9 10 11 12 13 14 15 16
17 18 19 20
clc ; K=(40*10^-6)/(%pi/2); J=0.5*10^-6; B=5*10^-6; eta=B/(2*(K*J)^0.5); disp ( e t a , ’ d a mp ing r a t i o = ’ ) wn=(K/J)^0.5; disp ( w n , ’ n a t u r a l f r e q u e n c y ( r a d / s e c ) ’ ) wd=wn*(1-(eta)^2)^0.5; disp ( w d , ’ fr eq ue nc y of damped o s c i l l a t i o n s ( rad / s ) ’ ) tc=1/wn; disp ( t c , ’ t i me c o n s t a n t ( s ) ’ ) ess=2*eta/wn; disp ( ’ f o r a ramp i np u t o f 5V, s te a d y s t a t e e r r o r (V) =’) ess=5*2*eta/wn; disp ( e s s , ’ ’ ) T_lag=2*eta*tc; disp ( T _ l a g , ’ T ime l a g ( s ) ’ )
Scilab code Exa 4.14 Calculate the natural frequency
1 // C a lc u l a te t h e n a t u r a l 2 clc ; 3 wn=2*%pi*30;
f re q u en c y
53
4 disp ( ’ f o r a f r e q u e n c y o f 3 0 Hz wn=(K/M+5 ∗ 10ˆ − 3) ˆ 0 . 5 . . . . . . . . . ( i ) ’ ); 5 disp ( ’ But wn=(K/M) ˆ 0 . 5 . . . . . . . . . ( i i ) ’ ) ; 6 disp ( ’ f o r a f r e q u e n c y o f 2 5 Hz wn=(K/M +5 ∗ 10 ˆ − 3+ 5 ∗ 10 ˆ − 3) ˆ 0 . 5 . . . . . . . . . ( i i i ) ’ ) 7 disp ( ’ o n s o l v i n g ( i ) , ( i i ) a nd ( i i i ) ’ ) 8 M=6.36*10^-3; 9 K=403.6; 10 disp (M , ’M= ’ ) 11 disp (K , ’K= ’ ) 12 w n = ( K / M ) ^ 0 . 5 ; 13 f = w n / ( 2 * % p i ) ; 14 disp (f , ’ n a t u r a l f r e q u e n cy ( Hz ) ’ )
Scilab code Exa 4.15 Calculate natural frequency and setteling time
1 2 3 4 5 6 7 8 9
/ / C a lc u l a te n a tu r a l f re q u en c y and s e t t e l i n g t i m e
clc ; K=60*10^3; M=30; wn=(K/M)^0.5; disp ( w n , ’ n a t u r a l f r e q u e n c y ( r a d / s e c ) ’ ) eta=0.7; ts=4/(eta*wn); disp ( t s , ’ s e t t e l i n g t im e ( s ) ’ )
Scilab code Exa 4.16 Calculate time lag and ratio of output and input
1 2 3 4 5
/ / C a l cu l a te t i me l a g and r a t i o o f o ut pu t a nd i np u t clc ; disp ( ’ when t im e p e r i o d w=2*%pi/600; tc=60;
i s 6 00 s ’ )
54
6 7 8 9 10 11 12 13 14 15 16
T _ l a g = ( 1 / w ) *atan ( w * t c ) ; disp ( T _ l a g , ’ t i m e l a g ( s )= ’ ) M=1/((1+(w*tc)^2)^0.5); disp (M , ’ r a t i o o f o ut pu t and i n pu t= ’ ) disp ( ’ when t im e p e r i o d i s 1 20 s ’ ) w=2*%pi/120; tc=60; T _ l a g = ( 1 / w ) *atan ( w * t c ) ; disp ( T _ l a g , ’ t i m e l a g ( s )= ’ ) M=1/((1+(w*tc)^2)^0.5); disp (M , ’ r a t i o o f o ut pu t and i n pu t= ’ )
Scilab code Exa 4.17 Calculate the maximum allowable time constant and
phase shift 1 / / C a l c u l a t e t h e maximum a l l o w a b l e t im e c o n s t a n t and
phase s h i f t 2 3 4 5 6 7 8 9 10 11 12
clc ; M=1-0.05; w=2*%pi*100; t c = { [ ( 1 / M ^ 2 ) - 1 ]/ ( w ^ 2 ) } ^ 0 . 5 ; disp ( t c , ’ maximum a l l o w a b l e t i m e c o n s t a n t ( s ) ’ ) disp ( ’ p ha se s h i f t a t 5 0 Hz ( d e g r e e )= ’ ) p h = [ - atan ( 2 * % p i * 5 0 * t c ) ] * ( 1 8 0 / % p i ) ; disp ( p h , ’ ’ ) disp ( ’ p ha se s h i f t a t 1 00 Hz ( d e g r e e )= ’ ) p h = [ - atan ( 2 * % p i * 1 0 0 * t c ) ] * ( 1 8 0 / % p i ) ; disp ( p h , )
Scilab code Exa 4.18 Calculate maximum value of indicated temperature
and delay time
55
1 / / C a l c u l a t e maximum v a l u e o f
i n d i c a t e d t e mp e r at u r e
and d e l a y t im e 2 3 4 5 6 7 8 9
10 11 12
clc ; T=120; w=2*%pi/T; tc1=40; tc2=20; M=[1/((1+(w*tc1)^2)^0.5)]*[1/((1+(w*tc2)^2)^0.5)]; M_temp=M*10; disp (M_temp , ’ maximum v a l u e o f i n d i c a t e d t e m p e r at u r e ( d e g r e e C) ’ ) p h = [ { atan ( w * t c 1 ) + atan ( w * t c 2 ) } ] ; T_lag=ph/w; disp ( T _ l a g , ’ T ime l a g ( s ) ’ )
Scilab code Exa 4.19 Find the output
1 / / Fi nd t h e o ut p ut 2 clc ; 3 disp ( ’ w hen t c = 0 . 2 ) ; 4 d i s p ( ’ o u t p u t = 1 / ( 1 + ( 2 * 0 . 2 ) ^ 2 ) ^ 0 . 5 ]sin [ 2 t - atan (2*0.2) ] + 3 / ( 1 + ( 2 * 0 . 2 ) ^ 2 ) ^ 0 . 5 ]sin [ 2 0 t - atan ( 2 0 * 0 . 2 ) ] ’ ) 5 disp ( ’ on s o l v i n g o ut pu t = 0. 9 3 s i n ( 2 t − 2 1 . 8 ) + 0 . 0 7 3 s i n ( 20 t − 76) ’ ) 6 disp ( ’ w hen t c = 0 . 0 0 2 ) ; 7 d i s p ( ’ o u t p u t = 1 / ( 1 + ( 2 * 0 . 0 0 2 ) ^ 2 ) ^ 0 . 5 ]sin [ 2 t - atan ( 2 * 0 . 0 0 2 ) ] + 3 / ( 1 + ( 2 * 0 . 0 0 2 ) ^ 2 ) ^ 0 . 5 ]sin [ 2 0 t - atan (20*0.002)]’) 8 disp ( ’ on s o l v i n g o ut p u t= 1 s i n ( 2 t − 0 . 2 3 ) + 0. 3 s i n ( 2 0 t −2.3) ’ )
Scilab code Exa 4.20 Calculate maximum and minimum value of indi-
cated temperature phase shift time lag 56
1 / / C a l c u l a t e maximum a nd minimum v a l u e
of in di ca te d
t em pe ra tu re , p ha se s h i f t , t im e l a g 2 3 4 5 6 7 8 9 10 11
12 13 14 15 16
clc ; T_max=640; T_min=600; T_mean=(T_max+T_min)/2; Ai=T_mean -T_min ; w=2*%pi/80; tc=10; Ao=Ai/{(1+(w*tc)^2)}^0.5; T_max_indicated=T_mean+Ao; disp (T_ma x_indicated , ’ Maximum v a l u e o f i n d i c a t e d t e m p e r a t u r e ( d e g r e e C )= ’ ) T_min_indicated=T_mean -Ao; disp (T_mi n_indicated , ’ Minimum v a l u e o f i n d i c a t e d t e m p e r a t u r e ( d e g r e e C )= ’ ) p h = - atan ( w * t c ) ; Time_lag=-ph/w; disp (Ti me_lag , ’ T ime l a g ( s ) ’ )
Scilab code Exa 4.21 determine damping ratio
1 2 3 4 5 6 7 8 9 10
/ / d e t er m i ne damping r a t i o
clc ; w=2; K=1.5; J=200*10^-3; wn=(K/J)^0.5; u=w/wn; M=1.1; eta=[{[1/(M^2)]-[(1-u^2)^2]}/(2*u)^2]^0.5; disp ( e t a , ’ d a mp ing r a t i o = ’ )
57
Scilab code Exa 4.22 Calculate the frequency range
1 2 3 4 5 6
/ / C a l cu l a te t he f r eq u en c y r an ge
7 8 9 10 11 12 13 14 15
clc ; eta=0.6; fn=1000; M=1.1; disp ( ’M=1 /[ [(1 − u ˆ 2 ) ˆ 2 ] + ( 2 ∗ u ∗ e t a ) ˆ 2 ] ˆ 0 . 5 ; . . . . . . . . . . ( i ) ’) disp ( ’ on s o l v i n g u ˆ4 − 0.5uˆ2+0.173=0 ’ ) disp ( ’ t he a bo ve e q u a ti o n g i v e s i ma gi na ry v a l ue s f o r f r e q ue n c y s o f o r e ta = 0.6 t he o ut pu t i s n o t 1 . 1 ’ ) disp ( ’ Now l e t M= 0. 9 , on s o l v i n g e q u a t i on ( i ) we h av e ’) disp ( ’ u ˆ 4 − 0 . 5 6 u ˆ 2 − 0.234=0 ’ ) disp ( ’ o n s o l v i n g u = 0. 91 6 ’ ) u=0.916; f=u*fn; disp (f , ’ maximum v a l u e o f r a n g e ( Hz )= ’ ) disp ( ’ So , t he r an ge o f t h e f r e qu e n c y i s fro m 0 t o 9 1 6 Hz ’ )
Scilab code Exa 4.23 determine the error
1 2 3 4 5 6 7 8 9
/ / d et er mi ne t he e r r o r
clc ; w=6; wn=4; u=w/wn; eta=0.66; M=1/{[(1-u^2)^2]+(2*eta*u)^2}^0.5; Error=(M-1)*100; disp ( E r r o r , ’ e r r o r (%)= ’ )
58
Chapter 5 Primary Sensing Elements and Transducers
Scilab code Exa 5.1 Calculate the deflection at center
1 2 3 4 5 6 7 8 9 10 11 12
// C a lc u l a te t h e d e f l e c t i o n a t c e n t er
clc ; D=15*10^-3; P=300*10^3; sm=300*10^6; t=[3*D^2*P/(16*sm)]^0.5; disp (t , ’ t h i c k n e s s (m)= ’ ) P=150*10^3; v=0.28; E=200*10^9; dm=3*(1-v^2)*D^4*P/(256*E*t^3); disp ( d m , ’ d e f l e c t i o n a t c e n t e r f o r P r e ss u r e o f 15 0 kN/m2(m)=’ )
Scilab code Exa 5.2 Calculate the angle of twist
59
1 2 3 4 5 6 7
// C a lc u l a te t h e a n g l e o f t w i s t
clc ; T=100; G=80*10^9; d=2*15*10^-3; th=16*T/(%pi*G*d^3) disp ( t h , ’ a n g l e o f t w i s t ( r ad )= ’ )
Scilab code Exa 5.3 Calculate the Torque
1 2 3 4 5 6 7 8 9 10
/ / C a l c u l a te t he To rque clc ;
E=110*10^9; t=0.073*10^-3; b=0.51*10^-3; l=370*10^-3; th=%pi/2; T=(E*b*t^3)*th/(12*l); disp (T , ’ C o n t r o l l i n g t o r q u e (Nm)= ’ )
Scilab code Exa 5.4 Calculating the displacement and resolution of the
potentiometer 1 / / C a l c ul a t i n g t he d i sp l ac em e nt and r e s o l u t i o n
potentiometer 2 3 4 5 6 7 8
clc ; Rnormal=10000/2; Rpl=10000/50; Rc1= Rnormal -3850; Dnormal=Rc1/Rpl; disp (Dno rmal , ’ Dis pl ac em en t (mm)=’ ) Rc2= Rnormal -7560;
60
o f t he
9 Dnormal=Rc2/Rpl; 10 disp (Dno rmal , ’ Dis pl ac em en t (mm)=’ ) 11 disp ( ’ s i n c e on e d i sp l ac e m e n t i s p o s i t i v e and o t he r
i s n e g a ti v e s o two d i s p l a ce m e n t s a re i n t he o p p o si t e d i r e c t i o n ’ ) 12 R e = 1 0 * 1 / 2 0 0 ; 13 disp ( R e , ’ R e s o l u t i o n (mm)= ’ )
Scilab code Exa 5.5 plot the graph of error versus K
1 2 3 4 5
/ / p l o t t h e g r a p h o f e r r o r v er s u s K clc ; K =[0 0.25 V =[0 -0.174 plot ( K , V )
0.5 0.75 1]; -0.454 -0.524
0];
Scilab code Exa 5.6 Calculating the output voltage
1 2 3 4 5 6 7 8 9
// C a l c u l a t i n g t he o ut pu t v o l t a g e
clc ; RAB=125; Rtotal=5000; R2=75/125*Rtotal; R4=2500; ei=5; eo=[(R2/Rtotal)-(R4/Rtotal)]*ei; disp ( e o , ’ o u t pu t v o l t a g e (V)= ’ )
Scilab code Exa 5.7 Calculating the maximum excitation voltage and the
sensitivity 61
1 / / C a l c u l a t i n g t he maximum e x c i t a t i o n
v o l t a g e and
the s e n s i t i v i t y 2 3 4 5 6 7 8 9 10
clc ; Rm=10000; Rp=Rm/15; R=600; P=5; e i = ( P * R ) ^ 0 .5 ; disp ( e i , ’ Maximum e x c i t a t i o n v o l t a g e (V)= ’ ) S=ei/360; disp (S , ’ S e n s i t i v i t y (V/ d e g r e e )= ’ )
Scilab code Exa 5.8 Calculating the resolution of the potentiometer
1 2 3 4 5
/ / C a l c u l a t i n g t he r e s o l u t i o n o f t h e p o t e n t i o m e t er clc ; Rwga=1/400; Re=Rwga/5; disp ( R e , ’ R e s o l u t i o n (mm)= ’ )
Scilab code Exa 5.9 Checking the suitability of the potentiometer
1 2 3 4 5 6 7 8 9
// C h ec k in g t he s u i t a b i l i t y o f t he p o t e n ti o m e t e r
clc ; mo=0.8; sr=250; sm=sr/mo; R=sm*1; disp (R , ’ r e s o l u t i o n o f 1mm movement ’ ) Rq=300/1000; disp ( R q , ’ r e s o l u t i o n r e q u i r e d= ’ )
62
10 disp ( ’ s i n c e t he r e s o l u t i o n o f p o t e n t i o m e t er
is h i g h e r t ha n t h e r e s o l u t i o n r e q u i r e d s o i t i s s u i t ab l e f o r the a p p li c at i o n ’ )
Scilab code Exa 5.10 Checking the suitability of the potentiometer
1 2 3 4 5 6 7 8
// C h ec k in g t he s u i t a b i l i t y o f t he p o t e n ti o m e t e r
clc ; Pd=(10^2)/150; disp ( P d , ’ P ower d i s s i p a t i o n (W)= ’ ) th_pot=80+Pd*30*10^-3; P D a = 1 - ( 1 0 *1 0 ^ - 3 ) * ( t h _ po t - 3 5 ) ; disp ( P D a , ’ P ower d i s s i p a t i o n a l l o w e d (W)= ’ ) disp ( ’ S i nc e power d i s s i p a t i o n i s h i g h e r th a n t he
d i s s i p a t i o n a l l o w ed s o p o t e n t i o m e t er i s n o t suitable ’)
Scilab code Exa 5.11 Calculating the possion ratio
1 2 3 4 5
// C a l c u l a t i n g t he p o s si o n ’ s r a t i o clc ; Gf=4.2; v=(Gf-1)/2; disp (v , ’ P os s io n s r a t i o = ’ )
Scilab code Exa 5.12 Calculating the value of the resistance of the gauges
1 / / C a l c u l a t i n g t h e v al ue o f t h e r e s i s t a n c e o f t h e
gauges 2 clc ;
63
3 4 5 6 7
8 9 10 11
strain=-5*10^-6; Gf=-12.1; R=120; dR_nickel=Gf*R*strain; disp (dR_nickel , ’ ch an ge i n r e s i s t a n c e o f n i c k e l ( ohm )= ’) Gf=2; R=120; dR_nicrome=Gf*R*strain; disp (dR_nicrome , ’ c ha ng e i n r e s i s t a n c e o f n i cr o me ( ohm )= ’ )
Scilab code Exa 5.13 calculate the percentage change in value of the gauge
resistance 1 / / c a l c u l a t e t h e p e r c e n t a g e c h a n g e i n v al ue o f t he
g a ug e r e s i s t a n c e 2 3 4 5 6 7 8
clc ; s=100*10^6; E=200*10^9; strain=s/E; Gf=2; r_perunit=Gf*strain*100; disp (r_perunit , ’ P e rc en t ag e c ha ng e i n r e s i s t a n c e = ’ )
Scilab code Exa 5.14 Calculating the Gauge factor
1 2 3 4 5 6
/ / C a l c u l a t i n g t h e Gauge f a c t o r
clc ; b=0.02; d=0.003; I=(b*d^3)/12; E=200*10^9;
64
7 8 9 10 11 12 13 14 15 16 17 18
x=12.7*10^-3; l=0.25; F=3*E*I*x/l^3; x=0.15; M=F*x; t=0.003; s=(M*t)/(I*2); strain=s/E; dR=0.152; R=120; Gf=(dR/R)/strain; disp ( G f , ’ Gauge f a c t o r = ’ )
Scilab code Exa 5.15 Calculating the change in length and the force ap-
plied 1 // C a l c u l a t i n g t he c h a ng e i n l e n g t h a nd t he f o r c e
applied 2 3 4 5 6 7 8 9 10 11 12 13 14
clc ; dR=0.013; R=240; l=0.1; Gf=2.2; dl=(dR/R)*l/Gf; disp ( d l , ’ c h a ng e i n l e n g t h (m)= ’ ) strain=dl/l; E=207*10^9; s=E*strain; A=4*10^-4; F=s*A; disp (F , ’ Fo rc e (N) ’ )
Scilab code Exa 5.16 Calculate the linear approximation
65
1 2 3 4 5 6 7 8 9 10 11
/ / C a l cu l a te t he l i n e a r a pp ro xi ma ti on
clc ; th1=30; th2=60; th0=th1+th2/2; Rth1=4.8; Rth2=6.2; Rth0=5.5; ath0=(1/Rth0)*(Rth2-Rth1)/(th2-th1); disp ( a t h 0 , ’ a l p h a a t o d e g r e e ( / d e g r e e C)= ’ ) disp ( ’ 5 . 5 [ 1 + 0 . 0 0 8 5 ( th − 45) ] ’ )
Scilab code Exa 5.17 Calculate the linear approximation
1 2 3 4 5 6 7 8 9 10 11
/ / C a l cu l a te t he l i n e a r a pp ro xi ma ti on
clc ; th1=100; th2=130; th0=th1+th2/2; Rth1=573.40; Rth2=605.52; Rth0=589.48; ath0=(1/Rth0)*(Rth2-Rth1)/(th2-th1); disp ( a t h 0 , ’ a l p h a a t o d e g r e e ( / d e g r e e C)= ’ ) disp ( ’ L i n e a r a p p r o x im a t i o n i s : Rth= 5 8 9 . 4 8 [ 1 + 0 . 0 0 1 8 2 ( th − 115) ] ’ )
Scilab code Exa 5.18 Calculate the resistance and the temperature
1 2 3 4
/ / C a l cu l a te t he r e s i s t a n c e and t he t em pe ra tu re clc ; Rth0=100; ath0=0.00392;
66
5 6 7 8 9 10
dth=65-25; R65=Rth0*[1+ath0*dth]; disp ( R 6 5 , ’ r e s i s t a n c e a t 65 d e gr e e C( ohm )= ’ ) t h = { [ ( 1 5 0 / 1 0 0 ) - 1 ]/ a t h 0 } + 2 5 ; disp ( t h , ’ T e m p er a t u re ( d e g r e e C ) ’ )
Scilab code Exa 5.19 Calculate the resistance
1 2 3 4 5 6 7
/ / C a lc u l a te t h e r e s i s t a n c e
clc ; Rth0=10; ath0=0.00393; dth=150-20; R150=Rth0*[1+ath0*dth]; disp ( R 1 5 0 , ’ r e s i s t a n c e a t 1 50 d e g r e e C ( ohm )= ’ )
Scilab code Exa 5.20 Calculate the time
1 2 3 4 5 6 7
/ / C a l cu l a te t he t im e
clc ; th=30; th0=50; tc=120; t = - 1 2 0 * [ log ( 1 - ( t h / t h 0 ) ) ] ; disp (t , ’ tim e ( s )= ’ )
Scilab code Exa 5.21 Calculate the resistance
1 / / C a lc u l a te t h e r e s i s t a n c e
67
2 3 4 5 6 7
clc ; R25=100; ath=-0.05; dth=35-25; R35=R25*[1+ath*dth]; disp ( R 3 5 , ’ r e s i s t a n c e a t 35 d e gr e e C( ohm )= ’ )
Scilab code Exa 5.22 find resistance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
//
clc ; Ro=3980; Ta=273; disp ( ’ 3 9 80 = a ∗ 3 9 8 0 ∗ e x p ( b / 2 7 3 ) ’ ) Rt50=794; Ta50=273+50; disp ( ’ 7 94= a ∗ 3 9 8 0 ∗ e x p ( b / 3 2 3 ) ’ ) disp ( ’ on s o l v i n g ’ ) disp ( ’ a = 30 ∗ 10 ˆ − 6 ’ , ’ b=2843 ’ ) Ta40=273+40; R t 4 0 = ( 3 0 * 1 0 ^ - 6 ) * 3 9 8 0 *exp ( 2 8 4 3 / 3 1 3 ) ; disp ( R t 4 0 , ’ R e s i s t a n c e a t 4 0 d e g r e e C ( ohm ) ’ ) R t 1 0 0 = ( 3 0 * 1 0 ^ - 6 ) * 3 9 8 0 *exp ( 2 8 4 3 / 3 7 3 ) ; disp ( R t 1 0 0 , ’ R e s i s t a n c e a t 1 00 d e g r e e C ( ohm ) ’ )
Scilab code Exa 5.23 calculating the change in temperature
1 2 3 4 5
/ / c a l c u l a t i n g t he c h a ng e i n t em pe ra tu re clc ; th=((1-1800/2000)/0.05)+70; dth=th-70; disp ( d t h , ’ c h an g e i n t e m p e r at u r e ( d e g r e e C) ’ )
68
Scilab code Exa 5.24 calculating the frequencies of oscillation
1 2 3 4 5 6
// cal cul ati ng the freq uen cie s of o s c i l l a t i o n
7 8 9 10 11 12
clc ; C=500*10^-12; R20=10000*(1-0.05*(20-25)); f20=1/(2*%pi*R20*C); disp ( f 2 0 , ’ F r e qu e n cy o f o s c i l l a t i o n a t 2 0 d e g r e e C ( Hz) ’ ) R25=10000*(1-0.05*(25-25)); f25=1/(2*%pi*R25*C); disp ( f 2 5 , ’ F r e qu e n cy o f o s c i l l a t i o n a t 2 5 d e g r e e C ( Hz) ’ ) R30=10000*(1-0.05*(30-25)); f30=1/(2*%pi*R30*C); disp ( f 3 0 , ’ F r e qu e n cy o f o s c i l l a t i o n a t 3 0 d e g r e e C ( Hz) ’ )
Scilab code Exa 5.25 Calculating the sensitivity and maximum output
voltage 1 / / C a l c u l a t i n g t he
s e n s i t i v i t y and maximum o ut pu t
voltage 2 clc ; 3 Se_thermocouple=500-(-72); 4 disp (Se_t hermocouple , ’ S e n s i t i v i t y o f t he rm oc ou pl e ( micro V/degree C)=’ ) 5 Vo=Se_thermocouple*100*10^-6; 6 disp ( V o , ’ maximum o u t p u t v o l t a g e ( V) = ’ )
69
Scilab code Exa 5.26 Calculating the temperature
1 2 3 4 5
/ / C a l c u l a t i n g t he t em pe ra t ur e clc ; ET=27.07+0.8; D i s p ( E T , ’ Req uir ed e .m. f . (mV) ’ ) disp ( ’ t em p er a tu re c o r r es p o n d in g t o 2 7 . 8 7 mV i s 62 0 degree C’)
Scilab code Exa 5.27 Calcating the series resistance and approximate er-
ror 1 // C a lc a ti n g t he
ser ies
r e s i s t a n c e and a pp ro xi ma te
error 2 3 4 5 6 7 8 9 10 11 12
13 14 15 16
clc ; Rm=50; Re=12; E=33.3*10^-3; i=0.1*10^-3; Rs=(E/i)-Rm-Re; disp ( R s , ’ s e r i e s r e s i s t a n c e ( ohm )= ’ ) Re=13; i1=E/(Rs+Re+Rm); AE=[(i1-i)/i]*800; disp ( A E , ’ a p pr o xi m at e e r r o r due t o r i s e o f 1 ohm i n Re ( d e g r e e C)= ’ ) R_change=50*0.00426*10; i1=E/(Rs+Re+Rm+R_change); AE=[(i1-i)/i]*800; disp ( A E , ’ a pp ro xi ma te e r r o r due t o r i s e 1 0 ( d e g r e e C)= ’ )
in resistance
i n Temp . o f
Scilab code Exa 5.28 Calculate the values of resistance R1 and R2
70
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/ / C a lc u l a te t h e v a l u es o f r e s i s t a n c e R1 and R2
clc ; E _ 2 0 = 0 . 1 1 2 * 1 0 ^ - 3 ; // emf a t 20 d e g r e e C E_900=8.446*10^-3; E_1200=11.946*10^-3; E1=E_900-E_20; E2=E_1200 -E_20 ; disp ( ’ E 1 = 1 . 0 8 ∗ R1 /( R1+2.5+R2 ) ; ( i ) ’) disp ( ’ E 2 = 1 . 0 8 ∗ ( R1 + 2. 5) / ( R1+2.5+R2 ) ; ( i i ) ’) disp ( ’ o n s o l v i n g ( i ) and ( i i ) ’ ) R1=5.95; R2=762.6; disp ( R 1 , ’ v a lu e o f r e s i s t a n c e R1 ( ohm )= ’ ) disp ( R 2 , ’ v a lu e o f r e s i s t a n c e R2 ( ohm )= ’ )
Scilab code Exa 5.29 Calculate the percentage linearity
1 2 3 4
/ / C a lc u l a te t h e p e r c e n t a g e l i n e a r i t y clc ; linearity_percentage=(0.003/1.5)*100; disp (linearity_percentage , ’ p e rc e n t ag e l i n e a r i t y = ’ )
Scilab code Exa 5.30 Calculate senstivity of the LVDT
1 / / C a l c u l a te
s e n s t i v i t y o f t he LVDT, I ns tr um en t and r e s o l u t i o n o f i n s tr um e n t i n mm
2 3 4 5 6 7 8
clc ; displacement=0.5; Vo=2*10^-3; Se_LVDT=Vo/displacement; disp (Se_ LVDT , ’ s e n s t i v i t y o f t h e LVDT ( V/mm) ’ ) Af=250; Se_instrument=Se_LVDT*Af;
71
9 disp (Se_inst rument , ’ s e n s t i v i t y ) 10 s d = 5 / 1 0 0 ; 11 V o _ m i n = 5 0 / 5 ; 12 R e _ i n s t r u m e n t = 1 * 1 / 1 0 0 0 ; 13 disp (Re_inst rument , ’ r e s o l u t i o n
o f i n s t r u m e n t (V/mm) ’
o f i n st r um e nt i n mm ’ )
Scilab code Exa 5.31 calculate the deflection maximum and minimum force
1 / / c a l c u l a t e t h e d e f l e c t i o n , maximum a nd minimum
force 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
clc ; b=0.02; t=0.004; I=(1/12)*b*t^3; F=25; l=0.25; E=200*10^9; x=(F*l^3)/(3*E*I); disp (x , ’ d e f l e c t i o n (m) ’ ) DpF=x/F; Se=DpF*0.5*1000; Re=(10/1000)*(2/10); F_min=Re/Se; F_max=10/Se; disp ( F _ m i n , ’ m inimum f o r c e ( N) ’ ) disp ( F _ m a x , ’ maximum f o r c e ( N) ’ ) disp ( S e , ’ ’ )
Scilab code Exa 5.32 calculating the sensitivity of the transducer
1 // c a l c u l a t i n g t h e 2 clc ;
s e n s i t i v i t y o f t h e t r a n s d u ce r
72
3 4 5 6 7 8
disp ( ’ p e r m i t t i v i t y o f t he a i r e0 = 8.85 ∗ 10ˆ − 12 ’ ) e0=8.85*10^-12; w=25*10^-3; d=0.25*10^-3; Se=-4*e0*w/d; disp ( S e , ’ s e n s i t i v i t y o f t he t r a n s d uc e r ( F/m)= ’ )
Scilab code Exa 5.33 Calculate the value of the capacitance afte the ap-
plication of pressure 1 / / C a lc u l a te t h e v al u e o f t h e c a pa c it a nc e a f t e t he
a p p l i ca t i o n o f p r es s ur e 2 3 4 5 6 7
clc ; C1=370*10^-12; d1=3.5*10^-3; d2=2.9*10^-3; C2=C1*d1/d2; disp ( C 2 , ’ t h e v al ue o f t he c a pa c it a n c e a f t e t h e a p p l i c a t i o n o f p r e s s u r e ( F )= ’ )
Scilab code Exa 5.34 Calculate the change in frequency of the oscillator
1 // C a l cu l a te t he c h a ng e i n f r eq u en c y o f t he
oscillator 2 3 4 5 6 7 8
clc ; fo1=100*10^3; d1=4; d2=3.7; fo2=[(d2/d1)^0.5]*fo1; dfo=fo1-fo2; disp ( d f o , ’ c h a ng e i n f r e q u e n c y ’)
73
o f t h e o s c i l l a t o r ( Hz )
Scilab code Exa 5.35 Calculate the dielectric stress change in value of ca-
pacitance 1 // Calculate the d i e l e c t r i c
s t r e s s , c ha ng e i n v a l u e
o f c a p ac i ta n c e 2 3 4 5 6 7 8 9 10 11 12 13 14
clc ; L_air=(3.1-3)/2; D_stress=100/L_air; e0=8.85*10^-12; l=20*10^-3; D2=3.1; D1=3; C = ( 2 * % p i ) * e 0 * l / (log ( D 2 / D 1 ) ) ; disp (C , ’ C a p a c i t a n c e ( F )= ’ ) l = ( 2 0 * 1 0 ^ - 3 ) - ( 2 *1 0 ^ - 3 ) ; C _ n e w = ( 2 * % p i ) * e 0 * l / (log ( D 2 / D 1 ) ) ; C_change=C-C_new; disp (C_ change , ’ c h a ng e i n C a p a c i t a n c e ( F )= ’ )
Scilab code Exa 5.36 Calculate the value of time constant phase shift se-
ries resistance amplitude ratio and voltage sensitivity 1 // C a l c u l a te t he v a lu e o f t im e c on s ta nt , p ha se s h i f t ,
s e r i e s r e s i s t a n c e , a mp li tu de r a t i o and v o l t a g e sensitivity 2 3 4 5 6 7 8
clc ; M=0.95; w=2*%pi*20; tc=(1/w)*[(M^2)/(1-M^2)]^0.5; disp ( t c , ’ t i me c o n s t a n t ( s ) ’ ) p h = { ( % p i / 2 ) - [atan ( w * t c ) ] } * ( 1 8 0 / % p i ) ; disp ( p h , ’ p h a s e s h i f t ( d eg ) ’ )
74
9 10 11 12 13 14 15 16 17
C=(8.85*10^-12*300*10^-6)/(0.125*10^-3); R=tc/C; disp (R , ’ s e r i e s r e s i s t a n c e ( ohm ) ’ ) M=1/(1+(1/(2*%pi*5*tc)^2))^0.5; disp (M , ’ a m pl i tu d e r a t i o = ’ ) Eb=100; x=0.125*10^-3; Vs=Eb/x; disp ( V s , ’ v o l t a g e s e n s i t i v i t y (V/m) ’ )
Scilab code Exa 5.37 Calculate the change in capacitance and ratio
/ / C a l c u l a te t he c ha ng e i n c a p a c i t a n ce and r a t i o
1 2 3 4 5 6 7 8 9 10 11
12 13 14 15 16 17 18 19 20 21
clc ; e0=8.85*10^-12; A=500*10^-6; d=0.2*10^-3; C=e0*A/d; d1=0.18*10^-3; C_new=e0*A/d1; C_change=C_new-C; Ratio=(C_change/C)/(0.02/0.2); disp ( R a t i o , ’ r a t i o o f p e r u n i t c h a n g e o f c a pa c it a nc e t o p er u n i t c ha ng e o f d i ap l ac e me n t ’ ) d1=0.19*10^-3; e1=1; d2=0.01*10^-3; e2=8; C=(e0*A)/((d1/e1)+(d2/e2)); d1_new=0.17*10^-3; C_new=(e0*A)/((d1_new/e1)+(d2/e2)); C_change=C_new-C; Ratio=(C_change/C)/(0.02/0.2); disp ( R a t i o , ’ r a t i o o f p e r u n i t c h a n g e o f c a pa c it a nc e t o p er u n i t c ha ng e o f d i ap l ac e me n t ’ )
75
Scilab code Exa 5.40 Calculate the output voltage and charge sensitivity
1 / / C a l cu l a te t he o ut pu t v o l t a g e and c ha rg e
sensitivity 2 3 4 5 6 7 8 9 10
clc ; g=0.055; t=2*10^-3; P=1.5*10^6; Eo=g*t*P; disp ( E o , ’ o u t p u t v o l t a g e (V)= ’ ) e=40.6*10^-12; d=e*g; disp (d , ’ c h ar g e s e n s i t i v i t y (C/N)= ’ )
Scilab code Exa 5.41 Calculate the force
1 2 3 4 5 6 7 8 9
/ / C a lc u l a te t h e f o r c e clc ; g=0.055; t=1.5*10^-3; Eo=100; P = E o /( g * t ); A=25*10^-6; F=P*A; disp (F , ’ Forc e (N)= ’ )
Scilab code Exa 5.42 Calculate the strain charge and capacitance clc
1 / / C a l cu l a te t he s t r a i n , c ha rg e and c a p a c i t an c e
76
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
clc ; A=25*10^-6; F=5; P=F/A; d=150*10^-12; e=12.5*10^-9; g=d/(e); t=1.25*10^-3; Eo=(g*t*P); strain=P/(12*10^6); Q=d*F; C=Q/Eo; disp (strain , ’ s t r a i n = ’ ) disp (Q , ’ ch ar ge (C)=’ ) disp (C , ’ C a p a c i t a n c e ( F )= ’ )
Scilab code Exa 5.43 calculate peak to peak voltage swing under open
and loaded conditions calculate maximum change in crystal thickness 1 / / c a l c u l a t e p eak t o p eak v o l t a g e s wi ng u n de r open
and l o ad e d c o n d i t i o n s 2 / / c a l c u l a t e maximum c ha ng e i n c r y s t a l t h i c k n e s s 3 4 5 6 7 8 9 10 11
12 13 14
clc ; d=2*10^-12; t=1*10^-3; Fmax=0.01; e0=8.85*10^-12; er=5; A=100*10^-6; Eo_peak_to_peak=2*d*t*Fmax/(e0*er*A); disp (Eo_p eak_to_peak , ’ p ea k v o l t a g e s wi ng u nd er o pen conditions ’) Rl=100*10^6; Cl=20*10^-12; d1=1*10^-3;
77
15 16 17 18 19 20 21
Cp=e0*er*A/d1; C=Cp+Cl; w=1000; m=[w*Cp*Rl/[1+(w*C*Rl)^2]^0.5]; El_peak_to_peak=[2*d*t*Fmax/(e0*er*A)]*m;
disp (El_p eak_to_peak , ’ p ea k v o l t a g e s wi ng u nd er l o ad e d c o n d i t i o n s ’ ) 22 E = 9 0 * 1 0 ^ 9 ; 23 d t = 2 * F m a x * t / ( A * E ) ; 24 disp ( d t , ’ maximum c ha ng e i n c r y s t a l t h i c k n e s s (m) ’ )
Scilab code Exa 5.44 Calculate the minimum frequency and phase shift
1 2 3 4 5 6 7 8
/ / C a l c u l a t e t h e minimum f r e q u e n c y and p ha s e s h i f t
clc ; M=0.95; tc=1.5*10^-3; w=(1/tc)*[(M^2)/(1-M^2)]^0.5; disp (w , ’ m inimum f r e q u e n c y ( r a d / s ) ’ ) p h = { ( % p i / 2 ) - [atan ( w * t c ) ] } * ( 1 8 0 / % p i ) ; disp ( p h , ’ p h a s e s h i f t ( d eg ) ’ )
Scilab code Exa 5.45 calculate sensitivity of the transducer high frequency
sensitivity Lowest frequency Calculate external shunt capacitance and high frequency sensitivity after connecting the external shunt capacitance 1 // c a l c u l a t e
s e n s i t i v i t y o f t he t ra n s du ce r , h ig h f r e q ue n c y s e n s i t i v i t y , L o wes t f r eq u en c y 2 / / C a l cu l a te e x t e r n a l s hu nt c a p a c i t a n c e and h ig h f re q u e n c y s e n s i t i v i t y a f t e r c o n n e c t i n g t h e e x t e r n a l s hu nt c a p a c i t a nc e 3 clc ;
78
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Kq=40*10^-3; Cp=1000*10^-12; K=Kq/Cp; disp (K , ’ s e n s i t i v i t y o f t he t r a n s du c e r (V/m) ’ ) Cc=300*10^-12; Ca=50*10^-12; C=Cp+Cc+Ca; Hf=Kq/C; disp ( H f , ’ h ig h f r eq u e nc y s e n s i t i v i t y (V/m) ’ ) R=1*10^6; tc=R*C; M=0.95; w=(1/tc)*[(M^2)/(1-M^2)]^0.5; f=w/(2*%pi); disp (w , ’ minimum f r e q u e n c y ( s ) ’ ) disp ( ’now f =10Hz ’ ) f=10; w=2*%pi*f; tc=(1/w)*[(M^2)/(1-M^2)]^0.5; C_new=tc/R; Ce=C_new-C; disp ( C e , ’ e x t e r n a l s hu nt c a p a c i t a n c e ( F) ’ ) Hf_new=Kq/C_new; disp (Hf_new , ’ new v a l ue o f h ig h f re q u en c y s e n s i t i v i t y (V/m) ’ )
Scilab code Exa 5.46 calculate op volatge
1 2 3 4 5 6 7
//
clc ; R=10^6; C=2500*10^-12; tc=R*C; t=2*10^-3; d=100*10^-12;
79
8 9 10 11 12 13 14 15 16 17
F=0.1; e l = 1 0 ^ 3 * { d * F * [exp ( - t / t c ) ] / C } ; disp ( e l , ’ v o l t a g e j u s t b e f o r e t =2ms (mV) ’ ) e l _ a f t e r = 1 0 ^ 3 * { d * F * [exp ( - t / t c ) - 1 ] / C } ; disp (el _after , ’ v o l t a g e j u s t a f t e r t =2ms (mV) ’ ) disp ( ’when t =10ms ’ ) t=10*10^-3; T=2*10 e _ 1 0 = 1 0 ^ 3 * { d * F * [exp ( ( - T / t c ) - 1 ) ] * { exp ( - ( t - T ) ) / t c } / C } disp ( e _ 1 0 , ’ o ut pu t v o l t ag e 10 ms a f t e r t he a p p l i c a t i o n o f i m p ul s e (mV) ’ )
Scilab code Exa 5.47 to prove time constant should be approximately 20T
1 / / t o p ro ve t im e c o n st a n t s h ou l d be a p pr o xi m at e ly 20
T t o k eep u n de rs h oo t w i th i n 5% 2 3 4 5 6 7 8
clc ; disp ( ’ Le t T=1 ’ ) ; T=1; el=0.95; t c = - T / log ( e l ) ; disp ( t c , ’ t i me c o n s t a n t ’ ) disp ( ’ a s T=1 s o t im e c o n s t a n t s h o u ld be a p pr o xi m at el y e q ua l t o 20T ’ )
Scilab code Exa 5.48 calculate op volatge
1 2 3 4 5 6
//
clc ; Kh=-1*10^-6; I=3; B=0.5; t=2*10^-3;
80
7 Eh=Kh*I*B/t; 8 disp ( E h , ’ o u t pu t v o l t a g e (V) ’ )
Scilab code Exa 5.49 Calculate the threshold wavelength
1 2 3 4
// C a l c u l a te t he t h r e s h o l d w av el en gt h clc ; Th_wavelength=1.24*10^-6/1.8’ disp (Th_wave length , ’ T h r e s h o l d w a v e l e n g t h (m) ’ )
Scilab code Exa 5.50 Calculate maximum velocity of emitted photo elec-
trons 1 / / C a l c u l a t e maximum v e l o c i t y
o f e m i tt e d p ho to
electrons 2 3 4 5 6 7
clc ; E_imparted=(1.24*10^-6)/(0.2537*10^-6); B_energy =E_imparted -4.30; em_ratio=0.176*10^12; v=(2*B_energy*em_ratio)^0.5; disp (v , ’ maximum v e l o c i t y o f e m it te d p ho to e l e c t r o n s (m/ s ) ’ )
Scilab code Exa 5.51 Calculate the resistance of the cell
1 2 3 4 5
// C a lc u l a te t h e r e s i s t a n c e o f t h e c e l l clc ; Ri=30; Rf=100; t=10;
81
6 tc=72; 7 R t = R i + ( R f - R i ) * [ 1 -exp ( - t / t c ) ] ; 8 disp ( R t , ’ r e s i s t a n c e o f t h e c e l l
(K ohm ) ’ )
Scilab code Exa 5.52 Calculate incident power and cut off frequency
1 2 3 4 5 6 7 8
/ / C a l c u l a te i n c i d e n t power and c ut o f f f r eq u e nc y
clc ; I_power=250*0.2*10^-6; disp (I_p ower , ’ i n c i d e n t p ow er (W) ’ ) Rl=10*10^3; C=2*10^-12; fc=1/(2*%pi*Rl*C); disp ( f c , ’ c ut o f f f r e qu e n cy ( Hz ) ’ )
Scilab code Exa 5.53 Calculate the internal resistance of cell and open
circuit voltage 1 // C a lc u l a te t h e i n t e r n a l
r e s i s t a n c e o f c e l l and
open c i r c u i t v o l t a g e 2 3 4 5 6 7 8 9
clc ; I=2.2*10^-3; Eo=0.33; Rl=100; Ri=(Eo/I)-100; disp ( R i , ’ i n t e r n a l r e s i s t a n c e o f c e l l ( ohm ) ’ ) V o = 0 . 3 3 * [ log ( 2 5 ) /log (10)]; disp ( V o , ’ open c i r c u i t v o l t a g e f o r a r a di a n t i n c i d e n c e o f 2 5 W/m2 (V)= ’ )
82
Scilab code Exa 5.54 Find the value of current
1 2 3 4 5 6 7 8 9
/ / Fi nd t he v a lu e o f c u r re n t
clc ; A=1935*10^-6; r=0.914; S_angle=A/r^2; I=180; L_flux=I*S_angle; disp (L_flux , ’ l u m ni o u s f l u x = ’ ) disp ( ’ C o r re s po n d in g t o l u mn i ou s f l u x o . 4 1 7 lm and a
l oa d r e s i s t a n c e o f 8 0 0 ohm t he c u r r e n t i s 12 0 mic ro Ampere ’ )
83
Chapter 6 Signal Conditioning
Scilab code Exa 6.1 calculating feedback resistance
1 2 3 4 5 6
// c a l c u l a t i n g f ee db a c k r e s i s t a n c e
clc ; A=100; R1=1*10^3; Rf=-A*R1; disp ( R f , ’ f e e d ba c k r e s i s t a n c e ( ohm )= ’ ) ;
Scilab code Exa 6.2 calculating the closed loop gain
1 2 3 4 5 6 7
/ / c a l c u l a t i n g t h e c l o s e d l oo p g ai n
clc ; Rf=10; R1=1; Avol=200000; A=-(Rf/R1)*(1/[1+(1/Avol)*((R1+Rf)/R1)]); disp (A , ’ c l o s e d l o op g a in= ’ )
84
Scilab code Exa 6.3 calculating the maximum output voltage
1 2 3 4 5 6
/ / c a l c u l a t i n g t h e maximum o ut p ut v o l t a g e
clc ; Sa=10; disp ( S a , ’ s a t u r a t i o n v o l t a g e= ’ ) Vom=Sa; disp ( V o m , ’ maximum o u t p u t v o l t a g e ’ )
Scilab code Exa 6.4 calculating output voltage due to offset voltage
1 2 3 4 5 6 7
// c a l c u l a t i n g o u tp ut v o l t a g e due t o o f f s e t v o l t a g e
clc ; Vos=5*10^-3; Rf=10; R1=1; Vo=-Vos*(1+Rf/R1); disp ( V o , ’ o ut pu t v o l t a g e due t o o f f s e t
v o l t a g e (V)= ’ )
Scilab code Exa 6.5 calculating Amplification factor
1 2 3 4 5 6 7
// c a l c u l a t i n g A m p l i fi c a t i o n f a c t o r clc ;
Rf=10; R1=1; A=Rf/R1; disp (A , ’ A m p l i f i c a t i o n F a ct o r= ’ )
Scilab code Exa 6.6 calculating output voltage due to offset voltage
85
1 2 3 4 5 6 7 8 9
// c a l c u l a t i n g o u tp ut v o l t a g e due t o o f f s e t v o l t a g e
clc ; V1=1; V2=-2; Rf=500; R1=250; R2=100; Vo=-{[(Rf/R1)*V1]+[(Rf/R2)*V2]}; disp ( V o , ’ o u t p u t v o l t a g e (V)= ’ )
Scilab code Exa 6.7 calculating gain and feedback resistance
1 2 3 4 5 6 7 8 9 10 11
/ / c a l c u l a t i n g g ai n and f ee db ac k r e s i s t a n c e clc ;
Rf=100*10^3; R1=1*10^3; A=Rf/R1; disp (A , ’ G a in= ’ ) disp ( ’ I f m u l t i p l i e r i s 10 ’ ) A=10; Rf=A*R1; disp ( R f , ’ f e e d b a c k r e s i s t a n c e
(Ohm)= ’ )
Scilab code Exa 6.8 Calculating the values of resistances
1 2 3 4 5 6 7
// C al cu la ti ng the v al ue s o f r e s i s t a n ce s
clc ; g=10; Rf=10; R1=Rf/g; disp ( R 1 , ’ r e s i s t a n c e R1 ( K il o −ohms)=’ ) R2=Rf/(0.5*g);
86
8 disp ( R 2 , ’ r e s i s t a n c e R1 ( K il o −ohms)=’ ) 9 R3=Rf/(0.333*g); 10 disp ( R 3 , ’ r e s i s t a n c e R1 ( K il o −ohms)=’ )
Scilab code Exa 6.9 Calculating the value of resistance and capacitance
1 // C a l c u l a t i n g t he v al u e o f r e s i s t a n c e and
capacitance 2 clc ; 3 Voramp=-10; 4 disp ( ’ i f v o l t a g e s o u r c e i s 10V t he n RC= 1 ms and i f C=1 micro −F ’ ) 5 C=1; 6 R=1*10^-3*10^6; 7 disp (R , ’ v a l u e o f r e s i s t a n c e ( ohm )= ’ )
Scilab code Exa 6.10 Calculating Difference mode gain and output volt-
age 1 / / C a l c u l a t i n g D i f f e r e n c e mode g a in and o ut pu t
voltage 2 3 4 5 6 7 8 9 10 11 12
clc ; V2=5*10^-3; V1=3*10^-3; Vo=300*10^-3; Vd=V2-V1; Ad=Vo/Vd; disp ( A d , ’ d i f f e r e n c e mode g a in= ’ ) V2=155*10^-3; V1=153*10^-3; Vo=Ad*(V2-V1); disp ( V o , ’ o u t pu t v o l t a g e (V)= ’ )
87
Scilab code Exa 6.11 Calculating Difference mode Common mode gain
and CMRR 1 // Calc ula ting
D i f f e r e n c e mode , Common mode g a i n and
CMRR 2 3 4 5 6 7 8 9 10 11 12
clc ; Vo=3; Vd=30*10^-3; Ad=Vo/Vd; disp ( A d , ’ d i f f e r e n c e mode g a in= ’ ) Vo=5*10^-3; Vc=500*10^-3; Ac=Vo/Vc; disp ( A c , ’Common mode ga in= ’ ) CMRR=Ad/Ac; disp ( C M R R , ’ Common mode r e j e c t i o n r a t i o = ’ )
Scilab code Exa 6.12 Calculating Signal to noise ratio and CMRR
1 2 3 4 5 6 7 8 9 10 11 12 13
/ / C a l c u l a t i n g S i g n a l t o n o i s e r a t i o and CMRR
clc ; V2=30*10^-3; V1=-30*10^-3; Vd=V2-V1; Ad=150; Vos=Ad*Vd; Ac=0.04; Vc=600*10^-3; Von=Ac*Vc; SNR=Vos/Von; CMRR=Ad/Ac; disp ( S N R , ’ S i g n a l t o N oi s e R at io= ’ )
88
14 15 disp ( C M R R , ’CMRR= ’ )
Scilab code Exa 6.13 Calculating sensitivity and output voltage
1 2 3 4 5 6 7 8 9 10 11
/ / C a l c u l a t i n g s e n s i t i v i t y and o ut p u t v o l t a g e
clc ; Ci=10*10^-12; Vi=10; Eo=8.85*10^-12; A=200*10^-6; K=-Ci*Vi/(Eo*A); disp (K , ’ s e n s i t i v i t y (V/mm)= ’ ) d=1*10^-6; Vo=K*d; disp ( V o , ’ o u t pu t v o l t a g e (V)= ’ )
Scilab code Exa 6.14 calculating minimum maximum time constants and
value of frequencies 1 / / c a l c u l a t i n g minimum , maximum t i me c o n s t a n t s a nd
v a l ue o f f r e q u e n c i e s 2 3 4 5 6 7 8 9 10 11
clc ; M X tc = 1 0 ^ 10 * 1 00 0 * 10 ^ - 1 2 ; disp ( M X t c , ’ Maximum t i m e c o n s t a n t ( s ) ’ ) ; M N tc = 1 0 ^ 8* 1 0 *1 0 ^ - 1 2 ; disp ( M N t c , ’ Minimum t i m e c o n s t a n t ( s ) ’ ) ; AR=0.95; fmin=(AR)/[2*%pi*MXtc*(1-AR^2)^0.5]; disp ( f m i n , ’ m inimum f r e q u e n c y ( Hz ) ’ ) fmax=(AR)/[2*%pi*MNtc*(1-AR^2)^0.5]; disp ( f m a x , ’ Maximum f r e q u e n c y ( H z ) ’ )
89
Scilab code Exa 6.15 calculating time constant and value of capacitance
1 // c a l c u l a t i n g
t i m e c o n s t a n t and v a lu e o f
capacitance 2 3 4 5 6 7 8 9 10
clc ; g=0.501; f=50; w=2*%pi*f; tc=(1-g^2)^0.5/(w*g); disp ( t c , ’ t i me c o n s t a n t ( s ) ’ ) R=10000; C=(tc/R)*10^6; disp (C , ’ c a p a c i t a n c e ( m ic ro −F ) ’ )
Scilab code Exa 6.16 calcuating the passband gain and upper and lower
cut off frequencies 1 // calcuating
t he p as sb an d g a in and u pp er & l ow er cut o f f f r eq u en c i es
2 3 4 5 6 7 8 9 10 11 12
clc ; R1=10*10^3; R2=1*10^6; A=R2/(R1+R2); disp (A , ’ g a i n = ’ ) C2=(0.01)*10^-6; C1=100*10^-12; fcl=1/(2*%pi*C2*R2); disp ( f c l , ’ l o we r c ut o f f f r eq u e nc y ( Hz ) ’ ) fcu=1/(2*%pi*R1*C1); disp ( f c u , ’ u pp er c ut o f f f r eq u e nc y ( Hz ) ’ )
90
Scilab code Exa 6.17 calcuating the value of C
1 2 3 4 5 6
/ / c a l c u a t i n g t h e v al ue o f C
clc ; R=1*10^6; fo=10*10^3; C=1/(2*%pi*fo*R); disp (C , ’ t he v a l ue o f C ( F) ’ )
Scilab code Exa 6.19 calculate the output voltage and sensitivity
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// c a l c u l a t e t h e o u t p u t v o l t a g e and s e n s i t i v i t y
clc ; Rt=100; K=1; Rb=K*Rt; ei=10; disp ( ’When K=1 ’ ) eo=[(K*Rt/Rb)/(1+(K*Rt/Rb))]*ei; disp ( e o , ’ o u tp u t v o l t a g e (V)= ’ ) Se=(ei*Rb)/[(Rb+K*Rt)^2]; disp ( S e , ’ s e n s i t i v i t y (V/ohm )= ’ ) K=0.95; disp ( ’When K=0.9 5 ’ ) eo=[(K*Rt/Rb)/(1+(K*Rt/Rb))]*ei; disp ( e o , ’ o u tp u t v o l t a g e (V)= ’ ) Se=(ei*Rb)/[(Rb+K*Rt)^2]; disp ( S e , ’ s e n s i t i v i t y (V/ohm )= ’ )
91
Scilab code Exa 6.20 calculate the output voltage for different values of
K 1 // c a l c ul a t e the output v ol ta ge
f o r d i f f e r e n t v al ue s
of K 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
clc ; ei=100; K=0.25; disp ( ’When K=0.2 5 ’ ) eo=[(K/6)/(1+(K/6))]*ei; disp ( e o , ’ o u tp u t v o l t a g e (V)= K=0.5; disp ( ’When K=0.5 ’ ) eo=[(K/6)/(1+(K/6))]*ei; disp ( e o , ’ o u tp u t v o l t a g e (V)= K=0.6; disp ( ’When K=0.6 ’ ) eo=[(K/6)/(1+(K/6))]*ei; disp ( e o , ’ o u tp u t v o l t a g e (V)= K=0.8; disp ( ’When K=0.8 ’ ) eo=[(K/6)/(1+(K/6))]*ei; disp ( e o , ’ o u tp u t v o l t a g e (V)=
’)
’)
’)
’)
Scilab code Exa 6.21 calculating the resistance and output voltage
1 2 3 4 5 6 7 8 9
/ / c a l c u l a t i n g t he r e s i s t a n c e and o ut p u t v o l t a g e
clc ; R2=119; R3=119.7; R1=120.4; R4=R2*R3/R1; R4=121.2; ei=12; eo=[(R1*R4-R2*R3)/((R1+R3)*(R2+R4))]*ei;
92
10 disp ( e o , ’ o u tp u t v o l t a g e
(V)= ’ )
Scilab code Exa 6.22 Calculating the bridge output
1 2 3 4 5 6 7 8 9 10 11 12
/ / C a l c u l a t i n g t he b r i d g e o ut pu t
clc ; ei=6; R=10000; disp ( ’ i f dR = 0 . 0 5R ’ ) dR=0.05*R; eo=[(dR/R)/(4+2*(dR/R))]*ei; disp ( e o , ’ o u t pu t v o l t a g e (V) ’ ) disp ( ’ i f dR= − 0.05R’ ) dR=-0.05*R; eo=[(dR/R)/(4+2*(dR/R))]*ei; disp ( e o , ’ o u t pu t v o l t a g e (V) ’ )
Scilab code Exa 6.23 Calculating the resistance of unknown resistance
1 2 3 4 5 6 7 8 9 10 11 12
// C a l c u l a t i n g t he r e s i s t a n c e o f u nknown r e s i s t a n c e
clc ; R2=800; R3=800; R4=800; Rm=100; R=800; ei=4; im=0.8*10^-6; dR=(im*R^2)*(4*(1+Rm/R))/ei; R1=R+dR; disp ( R 1 , ’ R e s i s t a n c e o f unknown r e s i s t o r
93
( ohm )= ’ )
Scilab code Exa 6.24 calculating the current
1 2 3 4 5 6 7 8 9 10 11 12 13
// c a l c u l a t i n g t he c u r r e n t
clc ; R2=1000; R3=1000; R1=1010; R4=1000; ei=100; eo=[(R1*R4-R2*R3)/((R1+R3)*(R2+R4))]*ei; disp ( e o , ’ open c i r c u i t v o l t a g e (V)= ’ ) Ro=[R1*R4/(R1+R4)]+[R2*R3/(R2+R3)]; Rm=4000; im=eo/(Ro+Rm); disp ( i m , ’ c u r r e n t (A)= ’ )
Scilab code Exa 6.25 Calculating maximum permissible current through
strain gauge supply voltage and Power dissipation in series resistance 1 / / C a l c u l a t i n g maximum p e r m i s s i b l e
c u r r e n t t h ro u gh
s t r a i n gaug e , s u pp l y v o l t a g e 2 / / and P ower d i s s i p a t i o n i n s e r i e s
r e s i s ta n c e
3 4 5 6 7 8 9 10 11
clc ; R=100; P=250*10^-3; i=(P/R)^0.5; disp (i , ’ maximum p e r m i s s i b l e c u r r e n t (A)= ’ ) ei=2*i*R; disp ( e i , ’ maximum s u p p l y v o l t a g e (V)= ’ ) Rs=100; Ps=10^2/Rs;
94
12 disp ( P s , ’ Power d i s s i p a t i o n )
in seri es
r e s i s t a n c e (W) ’
Scilab code Exa 6.26 Calculating the maximum voltage sensitivity of the
bridge 1 // C a l c u l a t i n g
t he maximum v o l t a g e s e n s i t i v i t y o f
t he b r i d g e 2 3 4 5 6 7 8 9 10
clc ; P=(0.1/0.2)*10^-3; R=1000; eim=2*(P*R)^0.5; dth=0.1; dR=(4.5/100)*dth*R; eom=(dR/(4*R))*eim; Sem=eom/dth; disp ( S e m , ’ maximum v o l t a g e (V)=’ )
s e n s i t i v i t y o f t he b r id g e
Scilab code Exa 6.27 Calculating the resolution of the instrument quan-
tization error and decesion levels 1 / / C a l c u l a t i n g t he r e s o l u t i o n
o f t he i ns tr um en t , q u a n t i z a ti o n e r r o r and d e ce s io n l e v e l s
2 3 4 5 6 7 8 9 10
clc ; Reso=10*10^-3/10; disp ( R e s o , ’ r e s o l u t i o n o f t he i n s t r um en t= ’ ) n=10; Q=10/2^n; Eq=Q/(2*3^0.5); disp ( E q , ’ q u a n t i z a t i o n e r r o r = ’ ) D=(2^n)-1; disp (D , ’ d e c e s i o n l e v e l s = ’ )
95
Scilab code Exa 6.28 Calculating the weight of MSB and LSB
1 2 3 4 5 6 7 8
/ / C a l c u l a t i n g t h e w e ig h t o f MSB and LSB
clc ; Ra=10; b=5; Wmsb=Ra/2; disp ( W m s b , ’ w e i g h t o f MSB ( V)= ’ ) Wlsb=Ra/2^b; disp ( W l s b , ’ w e i g h t o f LSB (V)= ’ )
Scilab code Exa 6.29 Calculating reference voltage and percentage change
1 // C a l c u l a t i n g
r e f e r e n c e v o l t a g e and p e rc e n t ag e
change 2 3 4 5 6 7 8 9
clc ; E=10; ER=E*256/255; disp ( E R , ’ R e f e r en c e v o l t a g e (V)= ’ ) n=8; CVlsb=(2^-n)*ER; PC=CVlsb*100/E; disp ( P C , ’ P e r c e n t a g e c h an g e = ’ )
Scilab code Exa 6.30 Calculating the number of bits Value of LSB Quan-
tization error minimum sampling rate Aperature time and dynamic range
96
1 / / C a l c u l a t i n g t he number o f b i t s , V al ue o f LSB ,
Q u a n t i z a t i o n e r r o r , minimum s a m p l in g r a t e A p e ra t u r e t i me a nd d yn am ic r a n g e 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
clc ; n=14; disp (n , ’ number o f b i t s = ’ ) E=10; Q=10; LSB=E/2^n; disp ( L S B , ’ V a lu e o f LSB (V) = ’ ) Eq=Q/(2*(3^0.5)); disp ( E q , ’ Q u a nt i za t io n e r r o r (V) = ’ ) fh=1000; fs=5*fh; disp ( f s , ’ minimum s a m p l in g r a t e ( Hz ) = ’ ) a=1/16384; ta=1/(2*%pi*fh)*a; disp ( t a , ’ A p e ra t u re t i me ( s ) = ’ ) Dr=6*n; disp ( D r , ’ d yn am ic r a ng e ( db ) = ’ )
Scilab code Exa 6.31 Calculating the value of resistance and smallest out-
put current 1 // C a l c u l a t i n g t he v al u e o f r e s i s t a n c e and s m a l l e s t
o ut p ut c u r r e n t 2 3 4 5 6 7 8 9
clc ; ER=10; n=6; Imax=10*10^-3; R=ER*((2^n)-1)/[(2^(n-2))*Imax]; disp (R , ’ r e s i s t a n c e ( ohm )= ’ ) LSB=ER/[(2^(n-1))*R]; disp ( L S B , ’ s m a l l e s t o ut pu t c u r r e n t (A) ’ )
97
Scilab code Exa 6.32 Calculating the output voltage
1 2 3 4 5
/ / C a l c u l a t i n g t he o ut pu t v o l t a g e
6 7 8
clc ; n=6; R=10000; I o = ( 1 0 / 10 * 1 0 ^3 ) *{1*1+1*0.5+1*0.25+0*0.125+1*0.0625}*10^-6; Rf=5000; Eo=-Io*Rf; disp ( E o , ’ O u tp ut v o l t a g e (V)= ’ )
Scilab code Exa 6.33 Calculate the output of successive approximation A
to D 1 / / C a l cu l a te t he o ut pu t o f s u c c e s s i v e
a pp ro xi ma ti on
A/D 2 3 4 5 6 7 8 9 10 11 12 13 14 15
clc ; disp ( ’ Set d3=1 ’ ) Output=5/2^1; disp ( ’ s i n c e 3 . 21 7 > 2 .5 s o d3=1 ’ ) disp ( ’ Set d2=1 ’ ) Output=(5/2^1)+(5/2^2); disp ( ’ s i n c e 3 .2 17 < 3 . 7 5 s o d2=0 ’ ) disp ( ’ Set d1=1 ’ ) Output=(5/2^1)+(5/2^3); disp ( ’ s i n c e 3 .2 17 > 3 . 12 5 s o d1=1 ’ ) disp ( ’ Set d0=1 ’ ) Output=(5/2^1)+(5/2^3)+(5/2^4); disp ( ’ s i n c e 3 .2 17 < 3 . 43 7 5 s o d0=0 ’ ) disp ( ’ O utput o f s u c c e s s i v e a p p ro x i ma t i on A/D = 1 01 0 ’ )
98
Scilab code Exa 6.34 to calculate op dc voltage
1 2 3 4 5 6 7 8 9 10 11
// t o c a l c u l a t e o /p dc v o l t a g e
clc ; t=400; T=t/4; C=1*10^-6; v=20; i=C*100*v/(T); R=1*10^3; e_o=i*R; disp ( e _ o , ’ o u t p u t v o l t a g e (V) ’ ) ;
99
Chapter 7 Display Devices and recorders
Scilab code Exa 7.1 calculating resolution
1 2 3 4 5 6 7 8
// c a l cu l a t in g r e s o lu t i o n
clc ; N = 4; R=1/10^N; disp (R , ’ R e s o l u t i o n o f t h e m et er= ’ ) ; VR=1; R1=VR*R; disp ( R 1 , ’ R e so l u ti o n o f t he m e t er f o r v o l t a g e r an ge 1 V= ’ ) ; 9 VR1=10; 10 R 2 = V R 1 * R ; 11 disp ( R 2 , ’ R e so l u ti o n o f t he m e t er f o r v o l t a g e r an ge 10V=’ ) ;
Scilab code Exa 7.2 calculating resolution
1 // c a l cu l a t in g 2 clc ;
r e s o lu t i o n
100
3 4 5 6 7 8 9 10 11 12 13 14
N = 3; R=1/10^N; disp (R , ’ R e s o l u t i o n o f t h e m et er= ’ ) ; disp ( ’ 1 2 . 9 8 w i l l be d i s p l a y e d a s 1 2 . 9 8 0 on 10V s c a l e ’) VR=1; R1=VR*R; disp ( R 1 , ’ R e so l u ti o n o f t he m e t er f o r v o l t a g e r an ge 1 V= ’ ) ; disp ( ’ 0 . 6 9 7 3 w i l l be d i s p l a y e d a s 0 .6 9 7 3 on 1V s c a l e ’) VR1=10; R2=VR1*R; disp ( R 2 , ’ R e so l u ti o n o f t he m e t er f o r v o l t a g e r an ge 10V=’ ) ; disp ( ’ 0 . 69 7 3 w i l l be d i s p l a y e d a s 0 0 .6 9 7 on 10V scal e ’)
Scilab code Exa 7.3 calculating Total possible error and percentage error
1 / / c a l c u l a t i n g T ot a l p o s s i b l e
e r r o r and p e r c e n t a g e
error 2 3 4 5 6 7 8 9 10 11 12 13
clc ; R=5; V=0.005*R; disp (V , ’ 0 . 5 p e rc e n t o f t he r e ad i ng ’ ) TPE=V+0.01; disp ( T P E , ’ T ot al p o s s i b l e e r r o r (V)= ’ ) R1=0.10; V1=0.005*R1; TPE1=V1+0.01; disp ( T P E 1 , ’ T ot al p o s s i b l e e r r o r (V)= ’ ) PE=(TPE1/0.1)*100; disp ( P E , ’ P e r ce n t a ge e r r o r = ’ )
101
Scilab code Exa 7.4 calculating frequency
1 2 3 4 5 6
/ / c a l c u l a t i n g f r e qu e n c y
clc ; N=034; t=10*10^-3; f=N/t; disp (f , ’ f r e q u e n c y ( Hz ) = ’ )
Scilab code Exa 7.5 calculating maximum error
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/ / c a l c u l a t i n g maximum e r r o r
clc ; R=5*10^6; V=0.00005*R; disp (V , ’ 0 . 0 0 5 p e r c e n t LSD=1; ME=V+1; disp ( M E , ’ Maximum e r r o r R=500; V=0.00005*R; disp (V , ’ 0 . 0 0 5 p e r c e n t LSD=1; ME=V+1; disp ( M E , ’ Maximum e r r o r
o f t h e r e a d i n g ( m ic ro s e c )= ’ ) ;
( m i c r o s e c )= ’ )
o f t h e r e a d i n g ( s e c )= ’ ) ;
( s e c )= ’ )
Scilab code Exa 7.6 calculating number of turns and current
1 / / c a l c u l a t i n g number o f t u r n s and c u r r e n t
102
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
clc ; D=8*10^-3; A=D^2; disp (A , ’A= ’ ) J=8*10^-3; K=16*10^-3; B=4*J*K; disp (B , ’B= ’ ) disp ( ’ s i n c e A
Scilab code Exa 7.7 calculating speed of the tape
1 2 3 4 5 6
// c a l c u l a t i n g s pe e d o f t h e t a pe
clc ; Lam=2.5*6.25; f=50000; S=Lam*10^-6*f; disp (S , ’ sp ee d (m/ s )= ’ )
Scilab code Exa 7.8 calculating number density of the tape
1 / / c a l c u l a t i n g number d e n s i t y o f t he t ap e 2 clc ;
103
3 ND=12000/1.5; 4 disp ( N D , ’ N umber d e n s i t y ( n u m be r s /mm) ’ )
Scilab code Exa 7.9 Calculating possible phase angles
1 2 3 4 5 6 7
/ / C a lc u la t in g p o s s i b l e phas e a n gl e s
clc ; Y1=1.25; Y2=2.5; PA=asind(Y1/Y2); disp ( P A , ’ p h as e a n g l e ( d e g r e e ) ’ ) disp ( ’ p o s s i b l e a n gl e a r e 30 d e g r ee and 33 0 d e g r ee ’ )
Scilab code Exa 7.10 Calculating possible phase angles
1 / / C a lc u la t in g p o s s i b l e phas e a n gl e s 2 clc ; 3 disp ( ’ i f s p ot g e n e r a t i n g p a t te r n moves i n t he c l o c k wi s e d i r e c t i o n ’ ) 4 Y1=0; 5 Y2=5; 6 PA=asind(Y1/Y2); 7 disp ( P A , ’ p h as e a n g l e ( d e g r e e ) ’ ) 8 Y1=2.5; 9 Y2=5; 10 P A = a s i n d ( Y 1 / Y 2 ) ; 11 disp ( P A , ’ p h as e a n g l e ( d e g r e e ) ’ ) 12 Y 1 = 3 . 5 ; 13 Y 2 = 5 ; 14 P A = a s i n d ( Y 1 / Y 2 ) ; 15 disp ( P A , ’ p h as e a n g l e ( d e g r e e ) ’ ) 16 Y 1 = 2 . 5 ; 17 Y 2 = 5 ;
104
18 P A = 1 8 0 - [ a s i n d ( Y 1 / Y 2 ) ] ; 19 disp ( P A , ’ p h as e a n g l e ( d e g r e e ) ’ )
105
Chapter 8 Metrology
Scilab code Exa 8.1 calculate the arrangement of slip gauges
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/ / c a l c u l a t e t h e a r r a n ge m e n t o f s l i p g au ge s
clc ; Dd=52.215; disp ( D d , ’ d e s i r e d v a l u e= ’ ) Pb=4; disp ( P b , ’ P r o t e c t e d b l o c k= ’ ) R=Dd-Pb; disp (R , ’ R e m in d e r= ’ ) Tp=1.005; disp ( T p , ’ t ho us an d b l o c k= ’ ) R=R-Tp; disp (R , ’ R e m in d e r= ’ ) Hp=1.010; disp ( H p , ’ H u n de r th s b l o c k = ’ ) R=R-Hp; disp (R , ’ R e m in d e r= ’ ) Ttp=2.20; disp ( T t p , ’ t e n t h s b l o c k= ’ ) R=R-Ttp; disp (R , ’ R e m in d e r= ’ ) Up=4;
106
22 23 24 25 26 27 28
disp ( U p , ’ u n i t b l o c k= ’ ) R=R-Up; disp (R , ’ R e m in d e r= ’ ) Tp=40; disp ( T p , ’ T en s b l o c k= ’ ) R=R-Tp; disp (R , ’ R e m in d e r= ’ )
Scilab code Exa 8.2 calculate the sensitivity
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
// c a lc u la t e the s e n s i t i v i t y
clc ; Ps=200*10^3; r=0.6; d2=0.5; d1=0.5; a=(d2/d1^2); x1=(1.1-r)/(2*a); disp ( x 1 , ’ x 1= ’ ) r=0.8; d2=0.5; d1=0.5; a=(d2/d1^2); x2=(1.1-r)/(2*a); disp ( x 2 , ’ x 2= ’ ) x=x1-x2; disp (x , ’ s o t h e r a ng e i s x (mm) ’ ) hS=%pi*d2*10^-3; A2=%pi*d2*10^-6*(x1+x2)/2; pS=-0.4*Ps/A2; pgS=25*10^-3/1000; S=hS*pS*pgS; disp (S , ’ s e n s i t i v i t y = ’ )
107
Scilab code Exa 8.3 calculate uncertainity in displacement
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/ / c a l c u l a t e u n c e r t a i n i t y i n d i s p l a c em en t
Pi=70*10^3; r=0.4; d2=1.6; d1=0.75; a=(d2/d1^2); x1=(1.1-r)/(2*a); disp ( x 1 , ’ x 1= ’ ) r=0.9; x2=(1.1-r)/(2*a); disp ( x 2 , ’ x 2= ’ ) x=x1-x2; disp (x , ’ s o t h e r a ng e i s x (mm) ’ ) d=-2*a; Wr=12.5/Pi; Wx=Wr/d; disp ( W x , ’ u n c e r t a i n i t y i n d i s p l a c e m en t (mm) ’ )
Scilab code Exa 8.4 calculate difference between height of workpieces and
pile of slip gauges 1 // c a l c u l a t e
d i f f e r e n c e b et w ee n h e i g h t o f w o r kp i e ce s and p i l e o f s l i p g au g e s
2 3 4 5 6
clc ; N=12; lem=0.644; d=N*lem/2; disp (d , ’ d i f f e r e n c e b et we e n h e i g h t o f w o rk p i e ce s and p i l e o f s l i p g au ge s ( m i cro −mete r ) ’ )
108
Scilab code Exa 8.5 calculate seperation distance between two surfaces
and angle of tilt 1 // c a l c u l a t e
s e p e r a t i o n d i s t a n c e b e t we en two s u r f a c e s and a n gl e o f t i l t
2 3 4 5 6
7 8 9
clc ; N=5; lem=546*10^-9; d=[(2*N-1)*lem*10^6]/4; disp (d , ’ s e p e r a t i o n d i s t a n c e b et we en two s u r f a c e s ( m i c r o −met er ) ’ ) x=75; th = atan ( d / x ) ; disp ( t h , ’ a n g l e o f t i l t ’ )
Scilab code Exa 8.6 Calculate the difference in two diameters
1 2 3 4 5 6 7
/ / C a lc u l a te t h e d i f f e r e n c e i n two d i a m e te rs
clc ; x=20/12; L=50-10; lem=0.6; d=(L*lem)/(2*x); disp (d , ’ d i f f e r e n c e − met er ) ’ )
i n d i a m e t er s o f t h e r o l l e r s ( m ic ro
Scilab code Exa 8.7 Calculate the change in thickness along its length
109
1 / / C a lc u l a te t h e c h a n g e i n t h i c k n e s s a lo ng
its
length 2 3 4 5
clc ; d=4.5-2.5; Tg=2*(0.5)*0.509; disp ( T g , ’ c ha ng e i n t h i c k n e s s a l on g i t s met er ) ’ )
110
l e n g th ( mi cro −
Chapter 9 Pressure Measurements
Scilab code Exa 9.1 calculating the length of mean free path
1 2 3 4 5 6
/ / c a l c u l a t i n g t he l e n g t h o f mean f r e e p a t h
clc ; T=273+20; P=101.3*10^3; mfp=22.7*10^-6*T/P; disp ( m f p , ’ l e n g th o f mean f r e e
pa th when p r e s s u r e i s o ne a t m o s p h e r i c p r e s s u r e (m) ’ )
7 P=133; 8 mfp=22.7*10^-6*T/P; 9 disp ( m f p , ’ l e n g th o f mean f r e e o n e t o r r (m) ’ ) 10 P = 1 3 3 * 1 0 ^ - 3 ; 11 m f p = 2 2 . 7 * 1 0 ^ - 6 * T / P ; 12 disp ( m f p , ’ l e n g th o f mean f r e e o n e m i c r o m e t er o f Hg (m) ’ ) 13 P = 2 4 9 . 1 ; 14 m f p = 2 2 . 7 * 1 0 ^ - 6 * T / P ; 15 disp ( m f p , ’ l e n g th o f mean f r e e o ne i n c h o f w a te r (m) ’ ) 16 P = 1 3 3 * 1 0 ^ - 6 ; 17 m f p = 2 2 . 7 * 1 0 ^ - 6 * T / P ;
111
pa th when p r e s s u r e i s
pa th when p r e s s u r e i s
pa th when p r e s s u r e i s
18 disp ( m f p , ’ l e n g th o f mean f r e e
pa th when p r e s s u r e i s
10 ˆ − 3 m i c r o m e t er o f Hg (m) ’ )
Scilab code Exa 9.2 Calculate Pressure of air source
1 2 3 4 5 6 7 8 9 10 11 12
/ / C a l cu l a t e P r es s u r e o f a i r s o u r c e
clc ; T=273+25; P=99.22*10^3; R=288; df=P/(R*T); dm=0.82*996; g=9.81; h=200*10^-6; P1=g*h*(dm-df)*10^3; Pa=P+P1; disp ( P a , ’ P r e s s u r e o f a i r s o u r c e (N/m2 ) ’ )
Scilab code Exa 9.3 Calculate Pressure head
1 2 3 4 5 6 7 8 9
/ / C a l c u l a t e P r e s s u r e h ea d
clc ; df=1*10^3; dm=13.56*10^3; g=9.81; h=130*10^-3; P=g*h*(dm-df); Ph=P/9.81; disp ( P h , ’ P r e s s u r e h e ad (mm o f w a t e r ) ’ )
112
Scilab code Exa 9.4 calculate height
1 2 3 4 5 6 7
// c a l c u l a t e h i g h t
clc ; h n = 25 0; d=5; D=25; h=hn*(1+(d/D)^2); disp (h , ’ h e i g h t ’ )
Scilab code Exa 9.6 calculate error interms of pressure
1 2 3 4 5 6 7 8 9 10
/ / c a l c u l a t e e r r o r i nt e rm s o f p r e s s u r e
clc ; P=8*133; h=P/(800*9.81); d=2; D=50; hn=h/(1+(d/D)^2); e=(hn-h)/h*100; eP=0.8*1000*9.81*(hn-h); disp ( e P , ’ e r r o r i n t e r m s o f p r e s s u r e (N/m2 ) ’ )
Scilab code Exa 9.7 calculate angle to which tube is incliend to vertical
1 / / c a l c u l a t e a ng l e t o whi ch t u b e i s
vertical 2 3 4 5 6 7
clc ; P=133; g=9.81; dm=13.56*10^3; R=10^-3; d=4;
113
i n c l ie n d to
8 9 10 11
D=20; th=asind(P/(g*dm*R*(1+(d/D)^2))); thV=90-th; disp ( t h V , ’ a n g l e t o w h i c h t u b e i s i n c l i e n d t o ve rt ic al ( degree ) ’ )
Scilab code Exa 9.8 calculate angle to which tube is incliend to horizontal
1 / / c a l c u l a t e a ng ng le to which tube i s
i n c l ie n d to
horizontal 2 3 4 5 6 7 8 9 10
clc ; P=9.81; g=9.81; dm=0.864*10^3; R=4*10^-3; d=2; D=20; th=asind(P/(g*dm*R*(1+(d/D)^2))); disp ( t h , ’ a n g l e t o w h i c h t u b e i s i n c l i e n d t o ho ri zo nta l ( degree ) ’ )
Scilab code Exa 9.9 calculate Length of scale angle to which tube is in-
cliend to horizontal 1 // c a l c u l a t e Length o f s c a l e a ng le to which tube i s
i n c l ie n d to h o ri z on t al 2 3 4 5 6 7 8
clc ; P=500*9.81; g=9.81; d=8; a = ( % p i / 4) 4) * d ^ 2 ; A=1200; dm=0.8*10^3;
114
9 10 11 12 13 14
hn=P/(g*dm*(1+(a/A))); disp ( h n , ’ L e ng n g t h o f s c a l e (m) ’ ) R=0.6; P1=50*9.81; th=asind(P1/(g*dm*R*[1+(a/A)])); disp ( t h , ’ a n g l e t o w h i c h t u b e i s i n c l i e n d t o ho ri zo nta l ( degree ) ’ )
Scilab code Exa 9.10 calculate diameter of the tube
1 2 3 4 5 6 7 8 9 10 11
/ / c a l c u l a t e d ia i a me m e te t e r o f t he he t u b e
clc ; P=100*10^3; g=9.81; di=10*10^-3; D=40*10^-3; A = ( % p i / 4) 4) * D ^ 2 ; dm=13.6*10^3; a=A/[P/(dm*g*di)-1]; d=(4*a/%pi)^0.5*10^3; disp ( d , ’ d i a m e t e r o f t h e t u b e (mm) ’ )
Scilab code Exa 9.11 calculate amplification ratio and percentage error
1 // // c a l c u l a t e
a m p l i f i c a t i o n r a t i o and p e r c e n t a g e
error 2 3 4 5 6 7 8
clc ; AR=1/(0.83-0.8); disp ( A R , ’ A m p l i f i c a t i o n r a t i o ’ ) D=50*10^-3; A = ( % p i / 4) 4) * D ^ 2 ; d=6*10^-3; a = ( % p i / 4) 4) * d ^ 2 ;
115
9 PR=(a/A)*100; 10 disp ( P R , ’ p e r c e n t a g e e r r o r ’ )
Scilab code Exa 9.12 calculate value of counter weight required
1 2 3 4 5 6 7 8 9 10
/ / c a l c u l a t e v al a l ue u e o f c ou o u nt n t er e r w e i gh gh t r e q u i r e d clc ; P=981; g=9.81; d=500*10^-3; A = ( % p i / 4) 4 ) * ( 1 0 * 10 10 ^ - 3 ) ^ 2 ; R=275*10^-3; th=30; W=A*d*P/(2*g*R*sind(th)); disp ( W , ’ v a lu l u e o f c o u nt n t e r w eeii gh gh t r e q u i r e d ( k g ) ’ )
Scilab code Exa 9.13 calculate damping factor time constant error and
time lag calculate damping factor natural frequency time constant error and time lag 1 / / c a l c u l a t e d a m p i n g f a c to t o r , t im i m e c on o n st s t an an t ,
error
a n d t im im e l a g 2 / / c a l c u l a t e d a m p i n g f a c t o r , n a t u r a l f re r e qu q u e nc n c y , t im im e c on o n s ta t a n t , e r r o r a n d t im im e l a g 3 4 5 6 7 8 9 10 11
clc ; Mp1=20/40; Mp2=10/40; Mp3=5/40; Eta=0.225; disp ( E t a , ’ d a mp mp in in g f a c t o r ’ ) Td=1.2; wd=2*%pi/Td; wn=wd/[(1-Eta^2)^0.5];
116
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
tc=1/wn; disp ( t c , ’ t i m e c o n s t a n t ( s ) ’ ) ess=2*Eta/wn; ess5=5*ess; disp ( e s s 5 , ’ e r r o r f o r 5mm/ s ra mp ( mm) ’ ) Tlag=2*Eta*tc; disp ( T l a g , ’ t i m e l a g ( s ) ’ ) Eta1=Eta*(0.5)^0.5; disp ( E t a 1 , ’ New d am pi ng f a c t o r ’ ) Td=1.2; w n1 = w n * (0 .5 ) ^ 0 .5 ; disp ( w n 1 , ’ New n a t u r a l f r e q u e n c y ( r a d / s ) ’ ) tc1=1/wn; disp ( t c 1 , ’ New t i m e c o n s t a n t ( s ) ’ ) ess51=ess5; disp ( e s s 5 1 , ’ n ew e r r o r f o r 5mm/ s ra mp ( mm) ’ ) Tlag1=Tlag; disp ( T l a g 1 , ’ n ew t i m e l a g ( s ) ’ ) ;
Scilab code Exa 9.14 calculate thickness of diaphram and natural frequency
1 // c a l c u l a t e
t h i c k n e s s o f d ia phra m and n a t ur a l
frequency 2 3 4 5 6 7 8 9 10 11
clc ; P=7*10^6; R=6.25*10^-3; v=0.28; E=200*10^9; t={[9*P*R^4*(1-v^2)/(16*E)]^0.25}*10^3; disp (t , ’ t h i c k n e s s o f d i a ph r a m (mm) ’ ) ds=7800; fn=[2.5*t/(%pi*R^2)]*[E/(3*ds*(1-v^2))]^0.5; disp ( f n , ’ n a t u r a l f r e q u e n c y ( Hz ) ’ )
117
Scilab code Exa 9.15 calculate the natural length of the spring and dis-
pacement 1 // c a l c u l a t e t h e n a tu r a l l e n g t h o f t he s p ri n g a nd
dispacement 2 3 4 5 6 7 8 9 10 11 12 13
clc ; P=100*10^3; A=1500*10^-6; F=P*A; Cs=F/3; Ls=Cs+40; disp ( L s , ’ n a t u r a l l e n g t h o f s p r i n g (mm) ’ ) P1=10*10^3; F1=P1*A; Ss=3+2*.5; D=F1/Ss; disp (D , ’ d i s p l a c e m e n t (mm) ’ )
Scilab code Exa 9.16 calculate the open circuit voltage
1 2 3 4 5 6 7 8 9 10 11 12
/ / c a l c u l a t e t h e op en c i r c u i t v o l t a g e
clc ; P=200*10^3; R=70*10^-3; v=0.25; t=1*10^-3; r=60*10^-3; E=200*10^9; S r = [ 3 * P * R ^ 2 * v / ( 8 * t ^ 2 ) ] * { ( 1 / v + 1 ) - ( 3/ v + 1 ) * ( r / R ) ^ 2 } ; S t = [ 3 * P * R ^ 2 * v / ( 8 * t ^ 2 ) ] * { ( 1 / v + 1 ) - ( 1/ v + 3 ) * ( r / R ) ^ 2 } ; Sta2=(Sr-v*St)/E; Sta3=(Sr-v*St)/E;
118
13 14 15 16 17 18 19 20 21
r0=10*10^-3; S r 1 = [ 3 * P * R ^ 2 * v / ( 8 * t ^ 2 ) ] * { ( 1 / v + 1 ) - ( 3/ v + 1 ) * ( r 0 / R ) ^ 2 } ; S t 1 = [ 3 * P * R ^ 2 * v / ( 8 * t ^ 2 ) ] * { ( 1 / v + 1 ) - ( 1/ v + 3 ) * ( r 0 / R ) ^ 2 } ; Sta1=(Sr1-v*St1)/E; Sta4=(Sr1-v*St1)/E; Gf=1.8; ei=12; eo=(Sta1+Sta4-Sta2-Sta3)*Gf*ei/4; disp ( e o , ’ o u t pu t v o l t a g e (V) ’ )
Scilab code Exa 9.17 calculate the optimum setting
1 2 3 4 5 6 7 8 9
/ / c a l c u l a t e t he optimum s e t t i n g
clc ; Aou=700*25*1/100; Aol=100*25*1/100; A o u P tP = 2 * A ou ; A o l P tP = 2 * A ol ; Se1=1; D1=AouPtP/Se1; disp ( D 1 , ’ d e f l e c t i o n
o f s c re e n c o r r e s p o n d i n g t o maximum p r e s s u r e f o r s e n s i t i v i t y o f 1mV/mm (mm) ’ ) 10 disp ( ’ s i n ch t he l e ng t h o f t he s c r ee n i s 1 00mm so waveform i s o ut o f r an ge and h en ce s e n s i t i v i t y s e t t i n g o f 1mV/mm s h o u l d n o t b e u s ed ’ ) 11 S e 2 = 5 ; 12 D 2 = A o u P t P / S e 2 ; 13 disp ( D 2 , ’ d e f l e c t i o n
o f s c re e n c o r r e s p o n d i n g t o maximum p r e s s u r e f o r s e n s i t i v i t y o f 5mV/mm (mm) ’ ) 14 disp ( ’ d e l e c t i o n i s w i th i n t he r an ge ’ ) 15 S e 3 = 2 0 ; 16 D 3 = A o u P t P / S e 3 ; 17 disp ( D 3 , ’ d e f l e c t i o n
o f s c re e n c o r r e s p o n d i n g t o maximum p r e s s u r e f o r s e n s i t i v i t y o f 2 0mV/mm (mm) ’ )
119
18 19 20 21
disp ( ’ d e l e c t i o n i s w i th i n t he r an ge ’ ) Se4=100; D4=AouPtP/Se4; disp ( D 4 , ’ d e f l e c t i o n o f s c re e n c o r r e s p o n d i n g t o
maximum p r e s s u r e f o r s e n s i t i v i t y o f 1 0 0mV/mm (mm) ’) 22 disp ( ’ d e l e c t i o n i s w i th i n t he r an ge ’ ) 23 S e 5 = 5 0 0 ; 24 D 5 = A o u P t P / S e 5 ; 25 disp ( D 5 , ’ d e f l e c t i o n
o f s c re e n c o r r e s p o n d i n g t o maximum p r e s s u r e f o r s e n s i t i v i t y o f 5 0 0mV/mm (mm) ’) 26 disp ( ’ d e l e c t i o n i s w i th i n t he r an ge ’ ) 27 disp ( ’ s i n c e t he s e n s i t i v i t y o f 5mV/mm g i v e s h i g h e r d e f l e c t i o n s o i t i s t h e optimum s e n s i t i v i t y ’ )
Scilab code Exa 9.18 calculate the output voltage of bridge
1 2 3 4 5 6 7 8 9
// c a l c u l a t e t h e o u t p u t v o l t a g e o f b r i d g e
clc ; d P = ( 7 0 0 0 * 1 0 ^ 3 ) - ( 1 0 0 *1 0 ^ 3 ) ; b=25*10^-12; R1=100; dR=R1*b*dP; ei=5; deo=dR*ei/(4*R1) disp ( d e o , ’ o ut p ut v o l t a g e o f b r i d g e (V) ’ )
Scilab code Exa 9.19 calculate attenuation
1 / / c a l c u l a t e a t te n u a ti o n 2 clc ; 3 T=273+20;
120