summaryrefslogtreecommitdiff
path: root/Tutorial1_Basic/Scilab_code/Tutorial1_function.sce
blob: 164430c3d4e6f402feb48ae5d8564fa444a44b74 (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
//This Matlab script is used to compute mean and standard deviation of data

//Clears all previous variables stored
clear 

//Clears screen
clc


//Executing the mymean function that computes the mean of a given data
exec mymean.sci;
//Executing the mystdev function that computes the standard deviation of a given data
exec mystdev.sci;


//Data for which the mean and standard-deviation is required
x = [1 2 5];

//Calling the mymean function. It takes data (a vector) as the input argument and returns mean of the data as output
mean_of_x = mymean(x);
disp(mean_of_x,'Mean of x');

//Calling the mystdev function. It takes data (a vector) and its mean as the input argument 
//It returns standard deviation of the data as output
stddev_of_x = mystdev(x,mean_of_x);
disp(stddev_of_x,'Standard deviation of x');