blob: bf9d12cb960a5b9e46bd906e87a21a46e71e3f11 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
// example 2-5 in page 25
clc;
//given data
V=[1.001 1.002 0.999 0.998 1.000];// 5 digital voltmeters reading in volts
//calculation
Vav=sum(V)/5;// average of 5 readings in volts
D=abs(V-Vav);//deviation of each reading from the average voltage
Dav=sum(D)/5;//average of deviation in volts
printf("Average measured voltage=%d V\n",Vav);
printf("Average deviation=%.4f V",Dav);
//result
//the Average measured voltage=1 V
//The Average deviation=0.0012 V
|