blob: ebc84c89a0548b9dc7fb55dc7d88f64a2bb4d622 (
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
|
//===========================================================================
//chapter 3 example 21
clc;clear all;
//variable declaration
x1 = 49.7; //voltage in V
x2 = 50.1; //voltage in V
x3 = 50.2; //voltage in V
x4 = 49.6; //voltage in V
x5 = 49.7; //voltage in V
n =5;
//ccalculations
x =(x1+x2+x3+x4+x5)/(5); //arthimetic mean
d1 =x-x1; //deviation
d2 =x-x2; //deviation
d3 =x-x3; //deviation
d4 =x-x4; //deviation
d5 =x-x5; //deviation
d = (d1**2)+(d2**2)+(d3**2)+(d4**2)+(d5**2);
sigma = sqrt(d/(n-1)); //standard devation
//result
mprintf("arthimetic mean = %3.2f ",x);
mprintf("\nstandard deviation = %3.3f",sigma);
|