summaryrefslogtreecommitdiff
path: root/174/CH1/EX1.1/example1_1.sce
blob: d0eb9e273815cb031207015b2abc216c536a506b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// To find Average voltage Range of error
// Modern Electronic Instrumentation And Measurement Techniques
// By Albert D. Helfrick, William D. Cooper
// First Edition Second Impression, 2009
// Dorling Kindersly Pvt. Ltd. India
// Example 1-1 in Page 3


clear; clc; close;

// Given data
E_1 = 117.02; // Voltage observed by 1st observer is 117.02V
E_2 = 117.11; // Voltage observed by 2nd observer is 117.11V
E_3 = 117.08; // Voltage observed by 3rd observer is 117.08V
E_4 = 117.03; // Voltage observed by 4th observer is 117.03V

//Calculations
E_av = (E_1+E_2+E_3+E_4)/4;
printf("(a)  The average voltage, E_av = %0.2f V\n ",E_av);

E_max = max (E_1,E_2,E_3,E_4); // Maximum value among the 4 nos
E_min = min (E_1,E_2,E_3,E_4); // Minimum value among the 4 nos

range_1 = E_max - E_av; // Range calculated using two different formulae
range_2 = E_av - E_min; // Range calculated using two different formulae

avg_range = (range_1+range_2)/2
printf("(b)  The average range of error = +/- %0.2f V",avg_range);

//Result
// (a)  The average voltage, E_av = 117.06 V
// (b)  The average range of error = +/- 0.05 V