summaryrefslogtreecommitdiff
path: root/331/CH3/EX3.17/Example_3_17.sce
blob: b6aecf340080c8fda29f85c6580551ead49a6ef1 (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
40
41
42
43
44
45
46
47
//Caption: Coefficient of variation
//Example3.17
//Page59
clear;
clc;
Busi_A = [80,85,70,100,115];
Busi_B = [100,70,90,80,150];
N = length(Busi_A);
XA = sum(Busi_A)/N;
XB = sum(Busi_B)/N;
VarA = 0;
VarB = 0;
for i = 1:N
    VarA = VarA+(Busi_A(i)-XA)^2;
    VarB = VarB+(Busi_B(i)-XB)^2;    
end
VarA = VarA/N;
VarB = VarB/N;
StdA = sqrt(VarA);
StdB = sqrt(VarB);
CovA = (StdA/XA)*100;
CovB = (StdB/XB)*100;
disp(CovA,'Coefficient of variation of A CVA =');
disp(CovB,'Coefficient of variation of B CVB=');
if (CovA<CovB) then
    disp('Since the coefficient of variation of the Business-A is less than')
    disp('that of the Business-B, the cash flow of business-A is more consistent')
    disp('when compared to that of the business-B')
else
    disp('Since the coefficient of variation of the Business-A is greater than')
    disp('that of the Business-B, the cash flow of business-A is not consistent')
    disp('when compared to that of the business-B')
end
//Result
//coefficient of variation of A CVA =   
// 
//    17.568209  
// 
// Coefficient of variation of B CVB=   
// 
//    28.425282  
// 
// Since the coefficient of variation of the Business-A is less than   
// 
// that of the Business-B, the cash flow of business-A is more consistent   
// 
// when compared to that of the business-B