diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /2360/CH2/EX2.21 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '2360/CH2/EX2.21')
-rwxr-xr-x | 2360/CH2/EX2.21/ex2_21.sce | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/2360/CH2/EX2.21/ex2_21.sce b/2360/CH2/EX2.21/ex2_21.sce new file mode 100755 index 000000000..583722b31 --- /dev/null +++ b/2360/CH2/EX2.21/ex2_21.sce @@ -0,0 +1,22 @@ +// Exa 2.21
+format('v',7);clc;clear;close;
+// Given data
+x= [29.6 32.4 39.4 28.9 30.0 33.3 31.4 29.5 30.5 31.7 33.0 29.2];// measured value
+n = 12;// number of reading
+sigma_x= 0;// initialization of variable
+for i=1:1:n
+ sigma_x= sigma_x+x(i);// sum of readings
+end
+x_bar=sigma_x/n;// mean value
+disp(x_bar,"The mean value is");
+sorted_x= gsort(x);
+x_median= (sorted_x(n/2)+sorted_x(n/2+1))/2;// median value
+disp(x_median,"The median value is : ")
+sigma_d_sq=0;
+for i=1:1:n
+ d(i)=x(i)-x_bar
+ sigma_d_sq= sigma_d_sq+d(i)*d(i);
+end
+sigma = sqrt( sigma_d_sq/(n-1) );//standard deviation in V
+disp(sigma,"The standard deviation in V is");
+
|