blob: 5d31c698e1af758c4d008a4e5702589946a5fb9e (
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
|
//===========================================================================
//chapter 3 example 22
clc;clear all;
//variable declaration
x1 = 41.7; //voltage in V
x2 = 42; //voltage in V
x3 = 41.8; //voltage in V
x4 = 42; //voltage in V
x5 = 42.1; //voltage in V
x6 = 41.9; //voltage in V
x7 = 42.5; //voltage in V
x8 = 42; //voltage in V
x9 = 41.9; //voltage in V
x10 = 41.8; //voltage in V
n =10;
//ccalculations
x =(x1+x2+x3+x4+x5+x6+x7+x8+x9+x10)/(10); //arthimetic mean
d1 =x-x1; //deviation
d2 =x-x2; //deviation
d3 =x-x3; //deviation
d4 =x-x4; //deviation
d5 =x-x5; //deviation
d6 =x-x6; //deviation
d7 =x-x7; //deviation
d8 =x-x8; //deviation
d9 =x-x9; //deviation
d10 =x-x10; //deviation
d = (d1^2)+(d2^2)+(d3^2)+(d4^2)+(d5^2)+(d6^2)+(d7^2)+(d8^2)+(d9^2)+(d10^2);
sigma = sqrt(d/(n-1)); //standard devation
r = 0.6745*sigma; //probable error of one reading
//result
mprintf("arthimetic mean = %3.2f ",x);
mprintf("\nstandard deviation = %3.3f",sigma);
mprintf("\nprobable error of ne reading = %3.3f",r);
|